-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to re-establish session connection after unexpected disconnect (
#5832) This change adds resiliency to the WebSocket connections that Positron uses to send and receive kernel messages. We were already detecting unexpected connection drops and using them to recover from server crashes. However, we've seen a few reports in the wild of these connection drops happening even when everything else is healthy. The improvement here is as follows: - If the session appears to be running, and the server is also running, we try to reestablish the connection. If we can, it is seamlessly resumed. Because messages that aren't delivered are queued on the supervisor side, we shouldn't miss any. - If the connection cannot be re-established, the user is shown a message and the session is marked offline. This prevents the session from looking inexplicably frozen. To help test this change without leaving Positron running for a day or more, I've added a development-only reconnect command that disconnects the socket for the active console session and lets the reconnect logic kick in to bring it back online. Addresses #5788. ### QA Notes If you can't reproduce the original issue, you can use a development build and this command. <img width="616" alt="image" src="https://github.com/user-attachments/assets/a135a664-d5a4-4ca9-8f5f-464491f15393" /> Since reconnect is meant to be seamless, check that the session can still run code after reconnecting, and check the logs to ensure that the reconnect sequence happened as expected. You should see something like this: ``` Session 'R 4.3.3' disconnected while in state 'idle'. This is unexpected; checking server status. Kallichore server PID 75482 is still running The server is still running; attempting to reconnect to session r-e6137faa Successfully restored connection to r-e6137faa ```
- Loading branch information
Showing
4 changed files
with
95 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters