jupyter_server
jupyter_server copied to clipboard
POST /api/kernels/{kernel_id}/interrupt 500 Response. "Kernel is in a pending state. Cannot interrupt."
Description
During kernel resart, interrupting causes server side 500 error and client side Error: Unhandled Error
https://user-images.githubusercontent.com/4434752/227858715-2ee65575-3a25-4bf2-9eae-3f5c3ab17247.mp4
Binder for the video: https://mybinder.org/v2/gh/binder-project/binder/HEAD (well, it is easily reproducable widly)
Chrome console log:
react_devtools_backend.js:2655 Traceback (most recent call last):
File "/home/leechanghwan/miniconda3/envs/jl3-ext/lib/python3.11/site-packages/tornado/web.py", line 1713, in _execute
result = await result
^^^^^^^^^^^^
File "/home/leechanghwan/miniconda3/envs/jl3-ext/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py", line 94, in post
await ensure_async(km.interrupt_kernel(kernel_id))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/leechanghwan/miniconda3/envs/jl3-ext/lib/python3.11/site-packages/jupyter_client/multikernelmanager.py", line 337, in interrupt_kernel
raise RuntimeError("Kernel is in a pending state. Cannot interrupt.")
RuntimeError: Kernel is in a pending state. Cannot interrupt.
jlab_core.6144df8e3fe03e33f880.js?v=6144df8e3fe03e33f880:2 Uncaught (in promise) Error: Unhandled error
at r.create (jlab_core.6144df8e3fe03e33f880.js?v=6144df8e3fe03e33f880:2:1029239)
at async Object.c [as interruptKernel] (jlab_core.6144df8e3fe03e33f880.js?v=6144df8e3fe03e33f880:2:1017461)
Server responce:
{
"message": "Unhandled error",
"reason": null,
"traceback": "Traceback (most recent call last):\n File \"/home/leechanghwan/miniconda3/envs/jl3-ext/lib/python3.11/site-packages/tornado/web.py\", line 1713, in _execute\n result = await result\n ^^^^^^^^^^^^\n File \"/home/leechanghwan/miniconda3/envs/jl3-ext/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py\", line 94, in post\n await ensure_async(km.interrupt_kernel(kernel_id))\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/leechanghwan/miniconda3/envs/jl3-ext/lib/python3.11/site-packages/jupyter_client/multikernelmanager.py\", line 337, in interrupt_kernel\n raise RuntimeError(\"Kernel is in a pending state. Cannot interrupt.\")\nRuntimeError: Kernel is in a pending state. Cannot interrupt.\n"
}
Reproduce
Check the video. Tips:
- click restart button and pop the dialog.
- move user mouse pointer to 'stop' button
- Press 'Enter' and click very fast and frequently
Expected behavior
Server might respond with error, but not 500. 4XX and with proper error message.
Context
Binder provided.
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:
Which version of Python and Jupyter you are using? Is it reproducible with lower version?