New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kernel/Interrupt Kernel does not terminate stuck subprocesses in the notebook #3400
Comments
duplicate of #514 |
Thanks, I hadn't spotted the duplicate. Having said that, t#514 is discussing a much more complex scenario, involving actually interacting with subprocesses (and it seems to be Unix based, as it's about pty-style interaction). For my requirements, a simple means of killing a rogue subprocess would do. Consider something as simple as |
Sorry, I see what you mean now. Reopening as a separate issue - interrupt not interrupting subprocesses on Windows. |
I'm not sure this is limited to subprocesses. Try executing |
@arijun on What OS? interrupting input and raw_input raise KeyboardInterrupt here (OS X). |
Sorry, windows. That's why I thought it was likely the same issue @pfmoore had, since that also happened on windows. |
Ah, crap. I know what that bug is. I think it's a libzmq (or pyzmq) bug that prevents it from handling interrupts properly while polling on zmq sockets. It's nothing in IPython. sigh |
I think I just got bitten by this and I'll need to restart the kernel, meaning I've just lost a lot of data… I was using Here's a minimal example that reproduces this: def test():
import pdb; pdb.set_trace() # XXX BREAKPOINT
return 0
test() Run this cell twice in a row. |
This same issue happens for me in Unix as well word for word. "When a subprocess is run from the notebook, if it gets stuck the kernel will get locked waiting for it. Selecting Kernel/Interrupt from the menu does not terminate the subprocess, but rather leaves the kernel in an unstable, "partially locked" state, where other cells do not execute. The only resolution is to restart the kernel." |
Thanks for the nice example of a pdb hang, wmayner. But sInce pdb doesn't run in a subprocess, I opened a separate issue for pdb: #10516 |
Printing too much data, let's say accidentally printing a gigantic numpy array, can make the kernel completely unresponsive and impossible to to terminate |
Has a solution been found for this issue yet? i just ran a machine learning model that took 14hr to complete and now my kernel is stuck and doesnt execute cells. if i restart, i have to run the model again for 14hrs. So is there any solution? |
haven't tried it, but this seems like it could help: http://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/limit_output/readme.html |
If a specific subprocess has got stuck, you can probably find it in the task manager and forcibly kill it that way. Hopefully that lets the kernel continue. |
no, the issue is that the kernel spams the webserver to death or something. killing the webserver kills the kernel afaik |
I'm dealing with a stuck notebook too: interrupt, restart, reconnect - none of them do anything. The The behavior began after running a cell containing:
Which is strange because I have analogous cells elsewhere that run successfully. I'm not sure how/if |
Is there any solution to this . Kernal cannot be interrupted . |
There was a process named conda.exe in Task manager. I killed that process and I was successfully able to interrupt the kernel |
Interrupt is still broken. I have to restart and reload my imports every time. |
same problem in jupyter lab on python 3.7 kernel |
same problem in Jupyter Notebook and I can't find the process named conda.exe in Task manager. Any updates on the solution yet? |
Not a solution |
Observing the same, in Windows 10 |
For the process issue specifically, on Windows specifically, here's a theory (still untested):
If that's the cause, switching to busy looping every 100ms or so would probably make it interruptible, or if not then taking the approach in the patch. |
Thank you @Carreau! |
Thanks @Carreau! When will this find its way into a general release, and does it mean that we will then be able to use the Interrupt Kernel button sucessfully? |
I'll likely do a 7.13 tomorrow. It might fix the interrupt button. |
@Arpit-Gole pdb is its own specific issue; I'm hoping to get that fixed soon too: #10516 |
@itamarst I am training a model as follows :
Now I know it is bound to take time-based on my dataset. But say for whatever reason I choose to stop the processing in half-way by pressing Kernel>Interrupt Kernel. Please Help! |
If what you are trying to interrupt is implemented in C then there is nothing to do. It's up to the library you use to handle sigint. |
I run into this sometimes too... Here is a reproduceable example from jupyer lab: LOAD DATA
Run Grid Search: THIS CANNOT BE INTERRUPTED
Is there any advice? |
run into this problem three times this afternoon, reminds me of the good old days when i was still using urllib. |
I am facing the same issue when using tensorflow and gpu for training deep learning model. |
Run into this with time.sleep and requests |
Also having this issue with time.sleep requests on Windows, but runs fine on Mac OS X |
Having this issue with ThreadPoolExecutor... Something like this:
Only way to interrupt is to restart kernel... very frustrating |
This is still happening. I would suggest re-opening this issue. Seeing it in a NumPy-heavy tight neural network training loop on Windows 10.
Is there anything I need to upgrade? |
Возникает такая же проблема, и самое интересное в случайных участках кода при использование B0 remote api для coppelia sim. При это если я использую Publisher и Subscriber |
Are there any news on this issue? I am working remotely in a Kubernetes pod and, when this occurs, I am completely locked out of the machine. I cannot even open a shell. |
@thistlillo your issue is most likely unrelated to this one. In any case, we would need more information than what you've provided, like: version of IPython and Python you're using, whether you are using Jupyter Notebook or Jupyter Lab, versions of those, etc. And, most importantly, a minimalized set of steps required to reproduce the issue. If you can provide this info, please create a new issue and include it. |
I ran into this issue today on my linux laptop. Although I have not found a way to interrupt the kernel, I was able to save my variables by injecting a |
Hey guys! I also had the same issue, but it was a silly mistake on my end. Avoid using try without adding specific exceptions in your except block you are expecting your code to throw. A generic try looks like this -
It seems like this code would also catches your keyboard Interrupts/ kernel interrupts which registers as KeyboardInterrupt exception (only if execution is inside this try block) . I thought it might help some unfortunate souls if I share it here. |
When a subprocess is run from the notebook, if it gets stuck the kernel will get locked waiting for it. Selecting Kernel/Interrupt from the menu does not terminate the subprocess, but rather leaves the kernel in an unstable, "partially locked" state, where other cells do not execute. The only resolution is to restart the kernel.
This occurred for me on Windows - I do not know if it also happens on Unix.
To demonstrate, start a notebook and enter !python in a cell. The process will lock as it is waiting for interactive input. As there is no way to provide that input, the kernel must be restarted to continue.
The text was updated successfully, but these errors were encountered: