Button closing tornado.WebSocketClosedError closing Stream

running a panel web application. When clicking on a button that should be rendering pn.Tabs material, I receive this error which is very vague to me to understand. Can anyone help?

message: Message ‘PATCH-DOC’ content: {‘events’: [{‘kind’: ‘MessageSent’, ‘msg_type’: ‘bokeh_event’, ‘msg_data’: {‘type’: ‘event’, ‘name’: ‘button_click’, ‘values’: {‘type’: ‘map’, ‘entries’: [[‘model’, {‘id’: ‘p1096’}]]}}}]}

Doesn’t look like an error to me.

Hard to say without an example.

My hunch was wrong. Problem is, I’m running the same script in 2 different places having the same environment. One is running well, the other is not. The error comes in the following sort:

WebSocket connection closed: code=None, reason=None
WebSocket connection opened
WebSocket connection closed: code=None, reason=None
tornado.websocket.WebSocketClosedError
raise WebSocketClosedError()
File "/usr/lib/python3/dist-packages/tornado/websocket.py", line 1094, in wrapper
Traceback (most recent call last):
During handling of the above exception, another exception occurred:
tornado.iostream.StreamClosedError: Stream is closed
await fut
File "/usr/lib/python3/dist-packages/tornado/websocket.py", line 1092, in wrapper
Traceback (most recent call last):
future: <Task finished name='Task-617' coro=<WebSocketProtocol13.write_message.<locals>.wrapper() done, defined at /usr/lib/python3/dist-packages/tornado/websock>
Task exception was never retrieved
Failed sending message as connection was closed
Failed sending message as connection was closed
Failed sending message as connection was closed

and then the following:


Apr 25 02:23:23 python3[2469129]: tornado.websocket.WebSocketClosedError
Apr 25 02:23:23 python3[2469129]:     raise WebSocketClosedError()
Apr 25 02:23:23 python3[2469129]:   File "/usr/lib/python3/dist-packages/tornado/websocket.py", line 444, in ping
Apr 25 02:23:23 python3[2469129]:     self._socket.ping(str(self._ping_count).encode("utf-8"))
Apr 25 02:23:23 python3[2469129]:   File "/usr/lib/python3/dist-packages/bokeh/server/connection.py", line 91, in send_ping
Apr 25 02:23:23 python3[2469129]:     c.send_ping()
Apr 25 02:23:23 python3[2469129]:   File "/usr/lib/python3/dist-packages/bokeh/server/tornado.py", line 787, in _keep_alive
Apr 25 02:23:23 python3[2469129]:     val = self.callback()
Apr 25 02:23:23 python3[2469129]:   File "/usr/lib/python3/dist-packages/tornado/ioloop.py", line 921, in _run
Apr 25 02:23:23 python3[2469129]: Traceback (most recent call last):
Apr 25 02:23:23 python3[2469129]: 2024-04-25 02:23:23,424 Exception in callback <bound method BokehTornado._keep_alive of <bokeh.server.tornado.BokehTornado object at 0x7f0140714df0>>
Apr 25 02:22:46 python3[2469129]: tornado.websocket.WebSocketClosedError

Updates:
@pgierz is the boss! Thanks.
Answer found in this discourse: Tornado Stream Error - #3 by pgierz

1 Like