Skip to content
This repository was archived by the owner on Dec 11, 2024. It is now read-only.

websocket connection closed #16

@reza-yb

Description

@reza-yb

websocket is not reliable and sometimes when an exception happens it does not restart. traceback of the exception that is happening from time to time is as follows:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 750, in transfer_data
    message = await self.read_message()
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 819, in read_message
    frame = await self.read_data_frame(max_size=self.max_size)
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 895, in read_data_frame
    frame = await self.read_frame(max_size)
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 971, in read_frame
    frame = await Frame.read(
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/framing.py", line 55, in read
    data = await reader(2)
  File "/usr/local/lib/python3.9/asyncio/streams.py", line 721, in readexactly
    raise exceptions.IncompleteReadError(incomplete, n)
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 2 expected bytes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/kucoin_futures/websocket/websocket.py", line 43, in _run
    _msg = await asyncio.wait_for(self._socket.recv(), timeout=self.get_ws_pingtimeout())
  File "/usr/local/lib/python3.9/asyncio/tasks.py", line 481, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 421, in recv
    await self.ensure_open()
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 726, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: code = 1006 (connection closed abnormally [internal]), no reason

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/kucoin_futures/websocket/websocket.py", line 56, in _run
    await self._reconnect()
  File "/usr/local/lib/python3.9/asyncio/tasks.py", line 654, in sleep
    return await future
asyncio.exceptions.CancelledError

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions