Hi, i dont know if this or the jupyter extension is the right place for this issue. Both seem to be involved. But as far as i know this is only related to Jupyterhub setups.
Environment data
VS Code version:Version: 1.87.2
Jupyter Extension version (available under the Extensions sidebar): 2024.2.0
Python Extension version (available under the Extensions sidebar): v2024.2.1
OS (Windows | Mac | Linux distro) and version: Linux Ubuntu
Python and/or Anaconda version: 3.10
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda/mamba
Jupyter server running: Tested on a Local Jupyterhub instance (docker setup).
Expected behaviour
In case a valid Jupyterhub configuration exists i can use it regardless if the referenced Jupyterhub instance is started or not. (And ideally it only starts the Jupyterhub instance if it is actually needed - See also https://github.com/microsoft/vscode-jupyter-hub/issues/47)
Actual behaviour
If i open VSCode and a Notebook file is being opened by it, VSCode correctly starts the configured Jupyterhub instance and everything is good. It probably would be better if it would only start it if i execute anything in the Notebook and not just "open" it but this is not my main issue.
If VSCode is already open and i open a Notebook file, VSCode also correctly starts the configured Jupyterhub instance and everything is fine.
But if i open a Notebook in VSCode and wait until the Jupyterhub instance is started, then manually stop the Jupyterhub instance
Jupyter (hub) extension and for example try to run the open Notebook, the Jupyter VSCode extension fails to reconnect/restart the Jupyterhub instance and worse it goes in a spin loop consuming lots of (CPU) resources and outputting lots of error messages.
Steps to reproduce:
Setup or use a local or remote Jupyterhub instance. Login in and start the server with a user. Setup a API Tokens for authentication on the Jupyterhub instance
Use the url, user name and token and create a new remote Jupyterhub connection in VSCode
Open a Jupyter Notebook and assign the remote Jupyterhub kernel to it.
Manually shutdown the started Jupyterhub instance. For example via the Hub Control Panel via in my case http://localhost:8000/hub/home.
Klick on Run all on the open Jupyter Notebok. Nothing is actually executed. See your CPU consumption spike and tons of (Error) Log messages apear in the Jupyter extension output.
Even closing the open Notebook tab does not stop the mayhem. Only starting the Jupyterhub instance or closing VSCode stops it.
Logs
Output for Jupyter in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Jupyter)
```
Visual Studio Code (1.87.2, undefined, desktop)
Jupyter Extension Version: 2024.2.0.
Python Extension Version: 2024.2.1.
Pylance Extension Version: 2024.3.2.
Platform: linux (x64).
Multiple Workspace folders opened <***************>
15:18:00.418 [info] Start refreshing Kernel Picker (1711635480418)
15:18:00.430 [info] Using Pylance
15:18:01.818 [info] Process Execution: ~/.mambaforge/envs/testenv/bin/python -m pip list
15:18:06.218 [info] No interpreter for Pylance for Notebook URI "<************>.ipynb"
15:18:19.464 [info] End refreshing Kernel Picker (1711635480418)
15:22:01.289 [info] Start refreshing Interpreter Kernel Picker
15:22:01.290 [info] Start refreshing Kernel Picker (1711635721290)
15:22:04.635 [info] End refreshing Kernel Picker (1711635721290)
15:22:21.814 [info] Handle Execution of Cells 5,8,10,14,15,20,22,30 for <************>.ipynb
15:22:21.815 [info] Starting Kernel startUsingRemoteKernelSpec, 5adb3d082669618c82c0e5dabb73fe10b2da13c5d4a85a24fa5a7de9c1131cb9..testenv./opt/conda/envs/testenv/python./.-m#ipykernel_launcher for '<************>.ipynb' (disableUI=false)
15:22:21.834 [error] Failed to fetch running kernels from remote server, connection may be outdated or remote server may be unreachable [r [Error]: JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user
at r.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:1006)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.Rl [as listRunning] (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:4507)
at async r.getRunningKernels (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12975)
at async Promise.all (index 0)
at async au.validateRemoteServer (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:2987)
at async au.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:1904)
at async ED.createJupyterSession (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:35972)] {
response: _Response [Response] {
size: 0,
timeout: 0,
[Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
[Symbol(Response internals)]: {
url: 'http://localhost:8000/hub/user/normal_user/api/kernels?1711635741818',
status: 424,
statusText: 'Failed Dependency',
headers: [_Headers [Headers]],
counter: 1
}
},
traceback: ''
}
15:22:21.836 [warn] Error occurred while trying to start the kernel, options.disableUI=false Error: Fehler beim Herstellen einer Verbindung mit dem Remote-Jupyter-Server „http://localhost:8000/“. Stellen Sie sicher, dass der Server ausgeführt wird und erreichbar ist. (Fehler beim Herstellen einer Verbindung mit dem Remote-Jupyter-Server „http://localhost:8000/“. Stellen Sie sicher, dass der Server ausgeführt wird und erreichbar ist. (JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user).).
> at au.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:2791)
> url = http://localhost:8000/user/normal_user/
> serverProviderHandle = [object Object]
> originalError = Error: Fehler beim Herstellen einer Verbindung mit dem Remote-Jupyter-Server „http://localhost:8000/“. Stellen Sie sicher, dass der Server ausgeführt wird und erreichbar ist. (JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user).
> baseUrl = http://localhost:8000/
> vslsStack = au.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:2791),process.processTicksAndRejections (node:internal/process/task_queues:95:5),async ED.createJupyterSession (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:35972)
15:22:21.837 [warn] Kernel Error, context = start Error: Fehler beim Herstellen einer Verbindung mit dem Remote-Jupyter-Server „http://localhost:8000/“. Stellen Sie sicher, dass der Server ausgeführt wird und erreichbar ist. (Fehler beim Herstellen einer Verbindung mit dem Remote-Jupyter-Server „http://localhost:8000/“. Stellen Sie sicher, dass der Server ausgeführt wird und erreichbar ist. (JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user).).
> at au.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:2791)
> url = http://localhost:8000/user/normal_user/
> serverProviderHandle = [object Object]
> originalError = Error: Fehler beim Herstellen einer Verbindung mit dem Remote-Jupyter-Server „http://localhost:8000/“. Stellen Sie sicher, dass der Server ausgeführt wird und erreichbar ist. (JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user).
> baseUrl = http://localhost:8000/
> vslsStack = au.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:2791),process.processTicksAndRejections (node:internal/process/task_queues:95:5),async ED.createJupyterSession (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:35972)
15:22:21.838 [info] Dispose Kernel '<************>.ipynb' associated with '<************>.ipynb'
15:22:21.840 [error] Jupyter Lab Helper:getKernelSpecs failure: [Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed.
at v.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935)
at ni.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299)
at r.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12579)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)]
15:22:23.839 [info] Start refreshing Kernel Picker (1711635743839)
15:22:23.856 [error] Error fetching kernels from http://localhost:8000/user/normal_user/ (JupyterHub (normal user)): [r [Error]: JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user
at r.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:1006)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.Rl [as listRunning] (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:4507)
at async r.getRunningKernels (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12975)
at async Promise.all (index 0)
at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:19197)
at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] {
response: _Response [Response] {
size: 0,
timeout: 0,
[Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
[Symbol(Response internals)]: {
url: 'http://localhost:8000/hub/user/normal_user/api/kernels?1711635743840',
status: 424,
statusText: 'Failed Dependency',
headers: [_Headers [Headers]],
counter: 1
}
},
traceback: ''
}
15:22:23.860 [error] Jupyter Lab Helper:getKernelSpecs failure: [Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed.
at v.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935)
at ni.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299)
at r.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12579)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 0)
at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:20060)
at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959]
15:22:23.881 [error] Error fetching kernels from http://localhost:8000/user/normal_user/ (JupyterHub (normal user)): [r [Error]: JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user
at r.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:1006)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.Rl [as listRunning] (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:4507)
at async r.getRunningKernels (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12975)
at async Promise.all (index 0)
at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:19197)
at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] {
response: _Response [Response] {
size: 0,
timeout: 0,
[Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
[Symbol(Response internals)]: {
url: 'http://localhost:8000/hub/user/normal_user/api/kernels?1711635743860',
status: 424,
statusText: 'Failed Dependency',
headers: [_Headers [Headers]],
counter: 1
}
},
traceback: ''
}
15:22:23.882 [error] Jupyter Lab Helper:getKernelSpecs failure: [Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed.
at v.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935)
at ni.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299)
at r.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12579)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 0)
at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:20060)
at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959]
15:22:23.906 [error] Error fetching kernels from http://localhost:8000/user/normal_user/ (JupyterHub (normal user)): [r [Error]: JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user
at r.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:1006)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.Rl [as listRunning] (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:4507)
at async r.getRunningKernels (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12975)
at async Promise.all (index 0)
at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:19197)
at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] {
response: _Response [Response] {
size: 0,
timeout: 0,
[Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
[Symbol(Response internals)]: {
url: 'http://localhost:8000/hub/user/normal_user/api/kernels?1711635743882',
status: 424,
statusText: 'Failed Dependency',
headers: [_Headers [Headers]],
counter: 1
}
},
traceback: ''
}
15:22:23.909 [error] Jupyter Lab Helper:getKernelSpecs failure: [Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed.
at v.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935)
at ni.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299)
at r.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12579)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 0)
at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:20060)
at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959]
15:22:23.925 [error] Error fetching kernels from http://localhost:8000/user/normal_user/ (JupyterHub (normal user)): [r [Error]: JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user
at r.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:1006)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.Rl [as listRunning] (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:4507)
at async r.getRunningKernels (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12975)
at async Promise.all (index 0)
at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:19197)
at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] {
response: _Response [Response] {
size: 0,
timeout: 0,
[Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
[Symbol(Response internals)]: {
url: 'http://localhost:8000/hub/user/normal_user/api/kernels?1711635743908',
status: 424,
statusText: 'Failed Dependency',
headers: [_Headers [Headers]],
counter: 1
}
},
traceback: ''
}
15:22:23.928 [error] Jupyter Lab Helper:getKernelSpecs failure: [Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed.
at v.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935)
at ni.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299)
at r.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12579)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 0)
at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:20060)
at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959]
15:22:23.940 [error] Error fetching kernels from http://localhost:8000/user/normal_user/ (JupyterHub (normal user)): [r [Error]: JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user
at r.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:1006)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.Rl [as listRunning] (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:4507)
at async r.getRunningKernels (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12975)
at async Promise.all (index 0)
at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:19197)
at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] {
response: _Response [Response] {
size: 0,
timeout: 0,
[Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
[Symbol(Response internals)]: {
url: 'http://localhost:8000/hub/user/normal_user/api/kernels?1711635743927',
status: 424,
statusText: 'Failed Dependency',
headers: [_Headers [Headers]],
counter: 1
}
},
traceback: ''
}
15:22:23.946 [error] Jupyter Lab Helper:getKernelSpecs failure: [Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed.
at v.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935)
at ni.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299)
at r.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12579)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 0)
at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:20060)
at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959]
15:22:23.960 [error] Error fetching kernels from http://localhost:8000/user/normal_user/ (JupyterHub (normal user)): [r [Error]: JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user
at r.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:1006)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.Rl [as listRunning] (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:4507)
at async r.getRunningKernels (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12975)
at async Promise.all (index 0)
at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:19197)
at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] {
response: _Response [Response] {
size: 0,
timeout: 0,
[Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
[Symbol(Response internals)]: {
url: 'http://localhost:8000/hub/user/normal_user/api/kernels?1711635743945',
status: 424,
statusText: 'Failed Dependency',
headers: [_Headers [Headers]],
counter: 1
}
},
traceback: ''
}
```
Hi, i dont know if this or the jupyter extension is the right place for this issue. Both seem to be involved. But as far as i know this is only related to Jupyterhub setups.
Environment data
Expected behaviour
In case a valid Jupyterhub configuration exists i can use it regardless if the referenced Jupyterhub instance is started or not. (And ideally it only starts the Jupyterhub instance if it is actually needed - See also https://github.com/microsoft/vscode-jupyter-hub/issues/47)
Actual behaviour
If i open VSCode and a Notebook file is being opened by it, VSCode correctly starts the configured Jupyterhub instance and everything is good. It probably would be better if it would only start it if i execute anything in the Notebook and not just "open" it but this is not my main issue.
If VSCode is already open and i open a Notebook file, VSCode also correctly starts the configured Jupyterhub instance and everything is fine.
But if i open a Notebook in VSCode and wait until the Jupyterhub instance is started, then manually stop the Jupyterhub instance Jupyter (hub) extension and for example try to run the open Notebook, the Jupyter VSCode extension fails to reconnect/restart the Jupyterhub instance and worse it goes in a spin loop consuming lots of (CPU) resources and outputting lots of error messages.
Steps to reproduce:
Setup or use a local or remote Jupyterhub instance. Login in and start the server with a user. Setup a API Tokens for authentication on the Jupyterhub instance
Use the url, user name and token and create a new remote Jupyterhub connection in VSCode
Open a Jupyter Notebook and assign the remote Jupyterhub kernel to it.
Manually shutdown the started Jupyterhub instance. For example via the
Hub Control Panel
via in my casehttp://localhost:8000/hub/home
.Klick on
Run all
on the open Jupyter Notebok. Nothing is actually executed. See your CPU consumption spike and tons of (Error) Log messages apear in the Jupyter extension output.Even closing the open Notebook tab does not stop the mayhem. Only starting the Jupyterhub instance or closing VSCode stops it.
Logs
Output for
Jupyter
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toJupyter
)``` Visual Studio Code (1.87.2, undefined, desktop) Jupyter Extension Version: 2024.2.0. Python Extension Version: 2024.2.1. Pylance Extension Version: 2024.3.2. Platform: linux (x64). Multiple Workspace folders opened <***************> 15:18:00.418 [info] Start refreshing Kernel Picker (1711635480418) 15:18:00.430 [info] Using Pylance 15:18:01.818 [info] Process Execution: ~/.mambaforge/envs/testenv/bin/python -m pip list 15:18:06.218 [info] No interpreter for Pylance for Notebook URI "<************>.ipynb" 15:18:19.464 [info] End refreshing Kernel Picker (1711635480418) 15:22:01.289 [info] Start refreshing Interpreter Kernel Picker 15:22:01.290 [info] Start refreshing Kernel Picker (1711635721290) 15:22:04.635 [info] End refreshing Kernel Picker (1711635721290) 15:22:21.814 [info] Handle Execution of Cells 5,8,10,14,15,20,22,30 for <************>.ipynb 15:22:21.815 [info] Starting Kernel startUsingRemoteKernelSpec, 5adb3d082669618c82c0e5dabb73fe10b2da13c5d4a85a24fa5a7de9c1131cb9..testenv./opt/conda/envs/testenv/python./.-m#ipykernel_launcher for '<************>.ipynb' (disableUI=false) 15:22:21.834 [error] Failed to fetch running kernels from remote server, connection may be outdated or remote server may be unreachable [r [Error]: JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user at r.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:1006) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.Rl [as listRunning] (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:4507) at async r.getRunningKernels (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12975) at async Promise.all (index 0) at async au.validateRemoteServer (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:2987) at async au.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:1904) at async ED.createJupyterSession (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:35972)] { response: _Response [Response] { size: 0, timeout: 0, [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null }, [Symbol(Response internals)]: { url: 'http://localhost:8000/hub/user/normal_user/api/kernels?1711635741818', status: 424, statusText: 'Failed Dependency', headers: [_Headers [Headers]], counter: 1 } }, traceback: '' } 15:22:21.836 [warn] Error occurred while trying to start the kernel, options.disableUI=false Error: Fehler beim Herstellen einer Verbindung mit dem Remote-Jupyter-Server „http://localhost:8000/“. Stellen Sie sicher, dass der Server ausgeführt wird und erreichbar ist. (Fehler beim Herstellen einer Verbindung mit dem Remote-Jupyter-Server „http://localhost:8000/“. Stellen Sie sicher, dass der Server ausgeführt wird und erreichbar ist. (JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user).). > at au.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:2791) > url = http://localhost:8000/user/normal_user/ > serverProviderHandle = [object Object] > originalError = Error: Fehler beim Herstellen einer Verbindung mit dem Remote-Jupyter-Server „http://localhost:8000/“. Stellen Sie sicher, dass der Server ausgeführt wird und erreichbar ist. (JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user). > baseUrl = http://localhost:8000/ > vslsStack = au.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:2791),process.processTicksAndRejections (node:internal/process/task_queues:95:5),async ED.createJupyterSession (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:35972) 15:22:21.837 [warn] Kernel Error, context = start Error: Fehler beim Herstellen einer Verbindung mit dem Remote-Jupyter-Server „http://localhost:8000/“. Stellen Sie sicher, dass der Server ausgeführt wird und erreichbar ist. (Fehler beim Herstellen einer Verbindung mit dem Remote-Jupyter-Server „http://localhost:8000/“. Stellen Sie sicher, dass der Server ausgeführt wird und erreichbar ist. (JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user).). > at au.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:2791) > url = http://localhost:8000/user/normal_user/ > serverProviderHandle = [object Object] > originalError = Error: Fehler beim Herstellen einer Verbindung mit dem Remote-Jupyter-Server „http://localhost:8000/“. Stellen Sie sicher, dass der Server ausgeführt wird und erreichbar ist. (JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user). > baseUrl = http://localhost:8000/ > vslsStack = au.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:2791),process.processTicksAndRejections (node:internal/process/task_queues:95:5),async ED.createJupyterSession (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:311:35972) 15:22:21.838 [info] Dispose Kernel '<************>.ipynb' associated with '<************>.ipynb' 15:22:21.840 [error] Jupyter Lab Helper:getKernelSpecs failure: [Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed. at v.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935) at ni.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299) at r.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12579) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)] 15:22:23.839 [info] Start refreshing Kernel Picker (1711635743839) 15:22:23.856 [error] Error fetching kernels from http://localhost:8000/user/normal_user/ (JupyterHub (normal user)): [r [Error]: JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user at r.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:1006) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.Rl [as listRunning] (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:4507) at async r.getRunningKernels (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12975) at async Promise.all (index 0) at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:19197) at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] { response: _Response [Response] { size: 0, timeout: 0, [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null }, [Symbol(Response internals)]: { url: 'http://localhost:8000/hub/user/normal_user/api/kernels?1711635743840', status: 424, statusText: 'Failed Dependency', headers: [_Headers [Headers]], counter: 1 } }, traceback: '' } 15:22:23.860 [error] Jupyter Lab Helper:getKernelSpecs failure: [Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed. at v.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935) at ni.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299) at r.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12579) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Promise.all (index 0) at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:20060) at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] 15:22:23.881 [error] Error fetching kernels from http://localhost:8000/user/normal_user/ (JupyterHub (normal user)): [r [Error]: JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user at r.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:1006) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.Rl [as listRunning] (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:4507) at async r.getRunningKernels (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12975) at async Promise.all (index 0) at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:19197) at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] { response: _Response [Response] { size: 0, timeout: 0, [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null }, [Symbol(Response internals)]: { url: 'http://localhost:8000/hub/user/normal_user/api/kernels?1711635743860', status: 424, statusText: 'Failed Dependency', headers: [_Headers [Headers]], counter: 1 } }, traceback: '' } 15:22:23.882 [error] Jupyter Lab Helper:getKernelSpecs failure: [Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed. at v.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935) at ni.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299) at r.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12579) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Promise.all (index 0) at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:20060) at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] 15:22:23.906 [error] Error fetching kernels from http://localhost:8000/user/normal_user/ (JupyterHub (normal user)): [r [Error]: JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user at r.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:1006) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.Rl [as listRunning] (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:4507) at async r.getRunningKernels (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12975) at async Promise.all (index 0) at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:19197) at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] { response: _Response [Response] { size: 0, timeout: 0, [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null }, [Symbol(Response internals)]: { url: 'http://localhost:8000/hub/user/normal_user/api/kernels?1711635743882', status: 424, statusText: 'Failed Dependency', headers: [_Headers [Headers]], counter: 1 } }, traceback: '' } 15:22:23.909 [error] Jupyter Lab Helper:getKernelSpecs failure: [Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed. at v.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935) at ni.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299) at r.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12579) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Promise.all (index 0) at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:20060) at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] 15:22:23.925 [error] Error fetching kernels from http://localhost:8000/user/normal_user/ (JupyterHub (normal user)): [r [Error]: JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user at r.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:1006) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.Rl [as listRunning] (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:4507) at async r.getRunningKernels (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12975) at async Promise.all (index 0) at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:19197) at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] { response: _Response [Response] { size: 0, timeout: 0, [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null }, [Symbol(Response internals)]: { url: 'http://localhost:8000/hub/user/normal_user/api/kernels?1711635743908', status: 424, statusText: 'Failed Dependency', headers: [_Headers [Headers]], counter: 1 } }, traceback: '' } 15:22:23.928 [error] Jupyter Lab Helper:getKernelSpecs failure: [Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed. at v.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935) at ni.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299) at r.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12579) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Promise.all (index 0) at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:20060) at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] 15:22:23.940 [error] Error fetching kernels from http://localhost:8000/user/normal_user/ (JupyterHub (normal user)): [r [Error]: JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user at r.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:1006) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.Rl [as listRunning] (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:4507) at async r.getRunningKernels (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12975) at async Promise.all (index 0) at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:19197) at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] { response: _Response [Response] { size: 0, timeout: 0, [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null }, [Symbol(Response internals)]: { url: 'http://localhost:8000/hub/user/normal_user/api/kernels?1711635743927', status: 424, statusText: 'Failed Dependency', headers: [_Headers [Headers]], counter: 1 } }, traceback: '' } 15:22:23.946 [error] Jupyter Lab Helper:getKernelSpecs failure: [Error: Poll (@jupyterlab/services:KernelSpecManager#specs) is disposed. at v.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:10935) at ni.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:29299) at r.dispose (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12579) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Promise.all (index 0) at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:20060) at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] 15:22:23.960 [error] Error fetching kernels from http://localhost:8000/user/normal_user/ (JupyterHub (normal user)): [r [Error]: JupyterHub server no longer running at /user/normal_user/api/kernels. Restart the server at http://localhost:8000/hub/spawn/normal_user at r.create (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:1006) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.Rl [as listRunning] (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/node_modules/@jupyterlab/services.js:11:4507) at async r.getRunningKernels (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:198:12975) at async Promise.all (index 0) at async sD.listKernelsFromConnection (~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:19197) at async ~/.vscode/extensions/ms-toolsai.jupyter-2024.2.0-linux-x64/dist/extension.node.js:308:17959] { response: _Response [Response] { size: 0, timeout: 0, [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null }, [Symbol(Response internals)]: { url: 'http://localhost:8000/hub/user/normal_user/api/kernels?1711635743945', status: 424, statusText: 'Failed Dependency', headers: [_Headers [Headers]], counter: 1 } }, traceback: '' } ```