-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Trouble shutting down terminals #5061
Comments
Confirmed on Windows 10 with Chrome 68 and JupyterLab 0.33.7. I did not see the behavior on MacOS with the same Chrome and JupyterLab versions. Thanks for the report! |
I am seeing similar issues with JupyterLab 0.33.8 running from a Jupyterhub install on Linux. Finished terminals restart themselves under a variety of conditions. The simplest way for me to reproduce it is to open a new terminal and immediately press CTRL+D. The terminal session reports it has terminated, but a second or two later I get a new active prompt:
I also get similar results to those reported above when I use the "Running" side tab to shut down active terminal sessions. This issue was not present when I was running Jupyterlab 0.32. It started for me as soon as I upgraded to an 0.33.x version. |
I also observe this issue on Linux , with version
After some digging, I find out the reason behind both phenomenon, which gets down to the browser-server interaction. Below are the server's log and the browser's log:
The message Moreover, sometimes the following error occurs when the websocket closes:
In human language, that is: This |
@blink1073 I feel like this is a fairly bad bug and should be fixed for 1.0 if possible. |
I'll give it a shot, but the solution may very well be that we remove support for terminals on Windows. It has proven to be more work than the team can accommodate given that none of us use Windows 10. |
Sounds a bit like #5065? Which has already been fixed. I've currently got docker build problem so can't confirm for sure. Anecdotally, I definitely had problems with terminals/notebooks restarting but haven't seen them more recently. |
Ah, I see the update now that it is not just a Windows problem. |
Thinking out loud: we need to ask the server if the terminal is still alive before reconnecting the socket automatically. |
@dhirschfeld This is still an issue for me in 0.34.9 |
The source of this problem comes from the class terminado.NamedTermManager, where its method
|
Thanks for implementing the dispose-on-disconnect feature. However, this issue #5061 is not yet fixed completely. There's still an edge case:
Then the dead terminal will come back to live. In order to close a terminal instance cleanly, all websockets to it should remain connected at the time of shutdown. That seems to be a very strong requirement. |
I've tested it on jupyterlab:master after the merge of blink1073:terminal-zombies. Below are the logs: Step 1:
Step 2 & 3:
Step 4:
|
@gdlmx, fair point. Reopening and marking as Future. |
I haven't followed this too closely, but for reference: Since tornado 4, the websocket close event sets attributes about whether the close was a clean shutdown (http://www.tornadoweb.org/en/stable/websocket.html#tornado.websocket.WebSocketHandler.on_close). |
Nice catch, we can look at that value and handle it if we haven't gotten a disconnect message already. As for the reconnect, we'd need to poll the rest API prior to each attempt to determine whether to try and open the websocket again , checking if the server still thinks we are running. |
I observed a similar behavior on linux, with jupyter lab version 1.2.6 and python 3.81.
I am new here, so I am not sure what information could be useful or if this bug report is still relevant. Please let me know if I should give more details. |
This patch prevents creation of a new terminal when handling websocket handshaking request. The default behavior of `terminado.NamedTermManager` is to automatically start a new terminal in response to a websocket handshake, which prevents a terminal from being properly shut down in JupyterLab as reported in this [issue](jupyterlab/jupyterlab#5061).
If persistently not responding to shutdown, in linux you can pinpoint the terminal process and kill it from the terminal. That was the only solution worked for me. |
From the launcher, I open a terminal (windows PowerShell). I go to the running tab on the sidebar, and click shutdown. The terminal displays
[Finished... Term Session]
. The terminal reappears in the running sidebar. At this point a couple of things might happen:I close the terminal tab, and reopen it from the running sidebar. It no longer displays
[Finished... Term Session]
. If I try to shut the terminal down again, it will restart. (I'm right back where I started)If I leave the terminal tab open with
[Finished... Term Session]
displayed and click shutdown a second time, the terminal shuts down without restarting.Here is a gif with the server console open on the right: (open in new tab to see it larger)
Also, if I close the terminal tab while it is still running when I hit shutdown. The terminal tab reopens, which is super annoying. It should just be gone.
Here is a gif with the server console open on the right: You can see an error is thrown.
The text was updated successfully, but these errors were encountered: