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
Fix inability to interrupt processes on Windows #12137
Fix inability to interrupt processes on Windows #12137
Conversation
I now have a process interrupting test that simulates how ipykernel handles interrupts, and it demonstrates that
|
It appears the subprocess also becomes uninterruptible while reading, not just during |
Investigating the Travis failure. |
Well you seem to know what you are doing and have a windows machine. I can't test, but the code seem reasonable. Thanks ! |
…137-on-7.x Backport PR #12137 on branch 7.x (Fix inability to interrupt processes on Windows)
Should this be working in IPython version 7.15.0? I couldn't get it to work. |
@amrita112 you also need the newest IPykernel. |
Fixes #3400
(or at least fixes the Windows subprocesses variant; there's a bunch of stuff in there that is probably separate tickets—at least pdb was moved out into its own).
It appears that in addition to wait() being uninterruptible (https://bugs.python.org/issue28168), so is read()ing from the subprocess.
Reading is therefore pushed off to threads, and
wait()
replaced with the equivalentpoll()
-based loop. If the user interrupts the process, it is killed.This is demonstrated by a unit test that previously failed, and now passes. Still remaining for me to do is actually test this fix on Windows from Jupyter; I'm waiting for a VM to unpack. If a reviewer wants to try this out themselves, by all means do so :)