Skip to content

Unexpected failure with error 'Websocket connection was closed: None' #438

Closed
@returnDanilo

Description

@returnDanilo

Sometimes, with no apparent reason, my server stops working with the following errors:

Websocket connection was closed: None
Websocket connection was closed: None
The channel "foobar" was unable to be joined. Check the channel is valid.
Websocket connection was closed: None
The channel "foobar" was unable to be joined. Check the channel is valid.
Websocket connection was closed: None
Task exception was never retrieved
future: <Task finished name='Task-2560' coro=<WSConnection._join_future_handle() done, defined at /usr/local/lib/python3.9/dist-packages/twitchio/websocket.py:327> exception=KeyError('foobar')>
Traceback (most recent call last):
  File "/usr/lib/python3.9/asyncio/tasks.py", line 492, in wait_for
    fut.result()
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/twitchio/websocket.py", line 329, in _join_future_handle
    await asyncio.wait_for(fut, timeout=timeout)
  File "/usr/lib/python3.9/asyncio/tasks.py", line 494, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/twitchio/websocket.py", line 332, in _join_future_handle
    self._join_pending.pop(channel)
Keyerror: 'foobar'
Websocket connection was closed: None
Websocket connection was closed: None
Websocket connection was closed: None
Websocket connection was closed: None
Websocket connection was closed: None
Websocket connection was closed: None
...

The websocket error line repeats many more times, but not the exception errors.

I've encountered this issue a few times. Usually it doesn't take 24 hours after the server is restarted until I see the error messages again.
I'm using twichio 2.8.2 installed from pypi.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions