When JupyterLab tries to restore its UI state and re-open terminals, it applies this logic:
// If a session name exists, try to connect to that terminal session.
let promise = name ?
services.terminals.connectTo(name)
// If unable to connect to a name that exists, start new terminal session.
.catch(() => services.terminals.startNew())
// If no name exists, start a new terminal session.
: services.terminals.startNew();
// Irrespective of how a terminal was generated (whether retrieved or
// newly created), associate that session with a terminal widget.
return promise.then(session => {
term.session = session;
tracker.add(term);
tracker.activate(term);
}).catch(() => { term.dispose(); });
This logic works on normal refreshes. However:
If you stop your jupyter server while keeping your browser session open.
Then you restart the server.
Then you refresh your browser.
You'll see the terminal widgets created, but they will hang because the session that is associated with the widget never seems to have an active web socket connection. This only fails the first time after the server is restarted. If you refresh a second time everything works as expected.
When JupyterLab tries to restore its UI state and re-open terminals, it applies this logic:
This logic works on normal refreshes. However:
jupyter
server while keeping your browser session open.You'll see the terminal widgets created, but they will hang because the session that is associated with the widget never seems to have an active web socket connection. This only fails the first time after the server is restarted. If you refresh a second time everything works as expected.
The broken state looks like this: