Kernel stops responding if the kernel is reconnected during code execution
- Dominant language
- Jupyter Notebook
- Stars
- 13.3k
- Forks
- 5.8k
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 7
Description
If the kernel reconnect happens during code execution, the current cell that was executed will return result, but all other cell executions will be marked as `executing` (`[*]`), but no output will be returned and kernel will not change the state to `busy`:
How to reproduce:
1. Start a Python notebook and wait until kernel is ready (the issue does not depend on kernel, I chose python kernel for reproducing, but any kernel could be used for test case.)
2. Start code cell execution with the following code:
```
import time
time.sleep(20)
```
3. While the cell is executing click `kernel -> reconnect` (you should click `reconnect` while the kernel is in `busy` state)
4. Wait until cell execution will be finished (the result will be displayed in the cell output)
5. Add new code cell and execute the following code: `print(1)`
6. The cell will change state to `executing` (`[*]`), but the kernel will be shown as idle and no output will be displayed.
Expected behavior: Execution result `1` should be displayed in the cell output for code `print(1)`
Reconnecting to the kernel (`kernel -> reconnect`) when it is in `idle` state solves the issue
Contributor guide
Research direction
Start by reproducing the reconnect-during-execution sequence with the provided sleep and print(1) cells, then trace the kernel reconnect and cell execution state transitions. Done means reconnecting while busy no longer leaves later cells marked executing without output, and the expected result 1 is displayed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100