Skip to content

Conversation

vincentye38
Copy link

Issue to fix:
A bug in GatewayWebSocketConnection cause buffered messages dropped when browser reconnections to /channels websocket with the same session_id.

ZMQChannelsWebsocketConnection in Jupyter Kernel Gateway (JKG) will buffer messages after disconnecting per session. If the reconnection is made with the same session id, ZMQChannelsWebsocketConnection.connect method will retrieve the buffered messages and send them to the client. If there session id is not set into ZMQChannelsWebsocketConnection.session.session, session.session will have a random UUIC.

KernelWebsocketHandler will set session.session to self.session, and self.session is populated by the WS request's parameter session.

If GatewayWebSocketConnection in JupyterServer makes a WS request to KernelWebsocketHandler in the JKG with a session id, the buffered messages associated with the session id will be replayed to the GatewayWebSocketConnection. However, GatewayWebSocketConnection doesn't put the session id into the request.
In the case when jupyterlab frontend creates a /channel WS connection to KernelWebsocketHandler in JupyterServer, it passes a session_id as the request parameter. When it reconnect to KernelWebsocketHandler due to disconnection, it will pass the same session_id. However this session id is not set by GatewayWebSocketConnection into the WS request to JKG. The session id used in the frontend is different than the one in the JKG. So the buffered messages are not replayed to the frontend, and dropped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants