tornadoweb / tornadoweb/tornado

WebSocketClosedError

Open
#3,565 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
22.2k
Forks
5.6k
Avg merge
3h 42m
Merged PRs (30d)
16

Description

Our JupyterLab servers have been getting this error:

Exception in callback BaseAsyncIOLoop._handle_events(16, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(16, 1)>
Traceback (most recent call last):
  File "/usr/lib64/python3.11/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/opt/app-root/lib64/python3.11/site-packages/tornado/platform/asyncio.py", line 202, in _handle_events
    handler_func(fileobj, events)
  File "/opt/app-root/lib64/python3.11/site-packages/terminado/management.py", line 265, in pty_read
    client.on_pty_read(s)
  File "/opt/app-root/lib64/python3.11/site-packages/terminado/websocket.py", line 81, in on_pty_read
    self.send_json_message(["stdout", text])
  File "/opt/app-root/lib64/python3.11/site-packages/terminado/websocket.py", line 86, in send_json_message
    self.write_message(json_msg)
  File "/opt/app-root/lib64/python3.11/site-packages/jupyter_server_terminals/handlers.py", line 67, in write_message
    super().write_message(message, binary=binary)
  File "/opt/app-root/lib64/python3.11/site-packages/tornado/websocket.py", line 332, in write_message
    raise WebSocketClosedError()
tornado.websocket.WebSocketClosedError

These logs occur even when the user is interacting with the terminal and there is no reason for the socket to close. It leads to lag, dropped keystrokes, and some other issues for our users.

Has this been seen before?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with tornado/websocket.py at the write_message call and trace the terminado/websocket.py and jupyter_server_terminals/handlers.py path shown in the report. Reproduce the error during active terminal use and determine why the socket is considered closed; done means the exception and resulting lag or dropped keystrokes no longer occur.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.