Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket handling error and reconnection with TCP_NODELAY=1 #115

Open
kheil117 opened this issue Jul 3, 2024 · 0 comments
Open

Websocket handling error and reconnection with TCP_NODELAY=1 #115

kheil117 opened this issue Jul 3, 2024 · 0 comments
Assignees

Comments

@kheil117
Copy link

kheil117 commented Jul 3, 2024

Hi team,

When I open a websocket by providing a socket to function KucoinWsClient.create() in order to set TCP_NODELAY to 1 (see example /example_customized_ws_public.py), exceptions are not handled correctly.

When the current websocket connection raises a ConnectionClosedError and then tries to reconnect via _reconnect(), the reconnection fails over and over with error: 'An operation was attempted on something that is not a socket', see below.

Note that without providing a socket to KucoinWsClient.create() and therefore not disabling TCP_NODELAY, the reconnection works.

WARNING _reconnect(112) <Task finished name='Task-X' coro=<ConnectWebsocket._run() done, defined at path\site-packages\kucoin\websocket\websocket.py:34> exception=ConnectionClosedError(None, None, None)> got an exception no close frame received or sent
WARNING _reconnect(124) _reconnect over.
INFO _reconnect(92) Websocket start connect/reconnect
INFO _reconnect(96) asyncio sleep reconnect_wait=1 s reconnect_num=1
INFO _reconnect(98) asyncio sleep ok
INFO _recover_topic_req_msg(127) recover topic event ['/market/level2:HBAR-USDT'] waiting

WARNING _reconnect(112) <Task finished name='Task-XXX' coro=<ConnectWebsocket._run() done, defined at path\site-packages\kucoin\websocket\websocket.py:34> exception=OSError(10038, 'An operation was attempted on something that is not a socket', None, 10038, None)> got an exception [WinError 10038] An operation was attempted on something that is not a socket

WARNING _reconnect(114) pending <Task pending name='Task-XXX' coro=<ConnectWebsocket._recover_topic_req_msg() running at path\site-packages\kucoin\websocket\websocket.py:128> wait_for=<Future pending cb=[Task.__wakeup()]>>
WARNING _reconnect(119) cancel ok.
WARNING _reconnect(124) _reconnect over._
@ISAAC-XXYYZZ ISAAC-XXYYZZ self-assigned this Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants