Issue: Kernel Cannot be Interrupted in Jupyter Notebook

Hello! I recently encountered the same issue with Kernel/Interrupt Kernel does not terminate stuck subprocesses in the notebook · Issue #3400 · ipython/ipython · GitHub.
When the kernel get stucked (regardless of whether in a subprocess), the “interrupt” button seems useless and the kernel keep running the previous program when it’s “interrupted”. Some suggestions, including reconnect the kernel, on github doesn’t work for me.
As for examples, I’ve tried the followings:

for a in range(1000000000):
a = a

import time
time.sleep(20)

Both of these cannot be stopped in Jupyter Notebook, so I can only restart the kernel or wait for it.
Such issue has been open for few years on github, is there any solution or response?
Thanks in advance for the help and advise!

1 Like