New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notify the user when a notebook kernel autorestarts #6246
Conversation
Thanks for making a pull request to JupyterLab! To try out this branch on binder, follow this link: |
One of the things I am seeing in my logging is that if I open a notebook, then open an associated console, then close the associate console, the websocket for the console kernel connection stays open, which means that it receives all of the broadcast iopub messages. We should probably close the kernel connection when a console is closed. Edit: I opened #6290 to deal with this issue |
This is now getting much closer. Restarts now don't disconnect and reconnect the websocket. The kernel status should switch from |
…he banner. Instead of requesting the kernel info a second time, just use the original kernel info we request for a kernel connection.
This makes sure we don’t miss messages during the restart, and helps the browser not have so many different websocket connections.
Now that we don’t reconnect when restarting, we’ll just show the banner right away.
Tests are still failing. This commit is a checkpoint in the work.
…to true along with resolving the promise.
This gets the test suite passing, and narrows down our work to the tests that are still failing.
I think the handler wasn’t getting removed after the check, so it was failing on the next signal emission. testEmission automatically removes the handler after the check, taking care of this issue.
…ring kernel state. Before, as soon as one kernel future rejected, clearState would return. Now all outstanding futures must resolve or reject before the state is considered cleared.
If a session or kernel is disposed, the requestKernelInfo done promise might reject. In that case, we should do nothing.
Kernel info is requested by the onWSOpen function already, which is what sets the connected state, so no need to request the kernel info here too.
…rejection. This fixes a number of tests as well.
Also clean up obsolete todo items.
jupyter/notebook#3705 noted some issues with kernel messages. I think these were mainly because we disconnected and reconnected the websocket on restart. We no longer do this, and these tests seem to pass, so let’s remove the TODO and keep an eye on it.
…n to match existing behavior. Throwing an error when shutting down a dead kernel causes a lot of test failures. So we keep the existing behavior and update the documentation, rather than changing the behavior to match the documentation.
@blink1073, @ian-r-rose, and everyone else - I think this is ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for digging through that state machine, nicely done!
References
Fixes #4273
This tackles some of the same issues as #4724, but is way less ambitious.
Code changes
autorestarting
kernel state is added for when a kernel is restarted automatically by the server (for example, if the kernel runs out of memory and dies, the server recognizes this from the heartbeat, and tries restarting it automatically)jlpm run coverage
now does not bail on the first failed test, but instead runs through all tests. This is so we can see all test failures instead of just the first one in CI.busy
,starting
, orrestarting
, instead of just showing idle when state wasidle
. Perhaps state should also show busy when state isautorestarting
?ready
(which means as soon as a request kernel info request succeeds, so the kernel is a known idle state). This means you don't need to wait until a kernel isready
before sending a message, and you can just await the resultingfuture.done
promise. This cuts down on a lot of test console errors where the kernel was disposed before it was done getting replies back.User-facing changes
A dialog pops up in a notebook when a kernel is autorestarted, with the same text as the classic notebook.
Backwards-incompatible changes
autorestarting
.