Connection error: 1006 - connection was closed uncleanly -> I am getting this error constantly

shivdas_b
I am having 200MBPS internet connection WiFi (with other backup wifi with same speed)
then why i am getting this errors too often

please provide details info if possible @sujith @rakeshr

error snapshot :
2024-05-16 10:49:27,452 ERROR Connection error: 1006 - connection was closed uncleanly (None)
2024-05-16 10:49:27,452 ERROR Connection closed: 1006 - connection was closed uncleanly (None)
2024-05-16 10:49:38,031 ERROR Connection error: 1006 - connection was closed uncleanly (None)
2024-05-16 10:49:38,032 ERROR Connection closed: 1006 - connection was closed uncleanly (None)
  • rakeshr
    ERROR Connection error: 1006 - connection was closed uncleanly (None)
    This is related to the blocking of main ticker thread. Go through the websocket FAQs here.
  • shivdas_b
    shivdas_b edited May 17
    @rakeshr I am clearly not writing any logic or placing any trades in ticker thread.
    also i am using threaded mechanism to pull data and store it in dictionary thats it.
    still getting these errors randomly .
  • rakeshr
    I just tried this threaded ticker code, and it's been working fine for more than 120 minutes. Make sure, you are handling threads properly.
  • shivdas_b
    shivdas_b edited May 21
    @rakeshr brother, issues does not arises on regular days, when everything going smoothly. I can completely agree with you that the code provided is working very fine and as intended.

    i has been an zerodha api user from NOV 2019.
    95% zerodha api works very smoothly. iam not letting you know about 95% cases. i am seeking clarity about those 5% of the time, where i am getting error.
    ERROR Connection error: 1006 - connection was closed uncleanly (None)

    even after having good 200MBPS network and stable code (which is running from last 2 years without any problems)
    just to clarify i am using threaded code provided by KiteConnect Only. and I do not overload or block thread in any mean.

    not criticising just seeking clarity & resolution.
    please help.
  • rakeshr
    @shivdas_b
    Can you try this in a single thread, and see if you are still getting connection closed?
  • visasimbu
    I too facing similar issue. almost from last week. Earlier i dont have any issue on my code.

    In my code also,I am just populating ticker data in dataframe. Nothing else in the code. Zerodha ticker is keep disconnecting and connecting for almost 30 mins. 3PM to 3.30 PM on today.

    2024-05-21 15:02:07: Connection error: 1006 - connection was closed uncleanly (None)
    2024-05-21 15:02:07: Ticker errored out. code = 1006, reason = connection was closed uncleanly (None)
    2024-05-21 15:02:07: Connection closed: 1006 - connection was closed uncleanly (None)
    2024-05-21 15:02:07: Ticker got disconnected. code = 1006, reason = connection was closed uncleanly (None)
    2024-05-21 15:02:09: Ticker connection successful.
    2024-05-21 15:05:09: Connection error: 1006 - connection was closed uncleanly (None)
    2024-05-21 15:05:09: Ticker errored out. code = 1006, reason = connection was closed uncleanly (None)
    2024-05-21 15:05:09: Connection closed: 1006 - connection was closed uncleanly (None)
    2024-05-21 15:05:09: Ticker got disconnected. code = 1006, reason = connection was closed uncleanly (None)
    2024-05-21 15:05:12: Ticker connection successful.
  • visasimbu
    Any update on this issue ?
  • sujith
    We don't see any issue at our end. You can try on an alternate network and check.
  • visasimbu
    Even now the same issue is happening. Websockets are exactly reconnecting from 3:10 PM to 3:30 PM.
  • sujith
    We don't see any disconnections or error logs at our end.

    PS: There are 10k+ Kite Connect production apps and even our internal apps use the Websocket APIs which is used by 46 lakh+ users during market. If there is an issue with Kite Ticker then it will be more chaotic.
  • visasimbu
    Sujith, I am not criticising your infra. Seeking some suggestions. Did you seen these sort of disconnections, if so what is your suggestions to avoid such disconnections on ticker. This was happening in more frequently only on last 30 minutes of market.
  • sujith
    It could be some edge case, sometimes actual error on the secondary thread is not printed. Use try catch blocks and check.
Sign In or Register to comment.