-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PR: Fix shutdown kernels associated to conda envs (IPython console) #17035
Conversation
@impact27, I think this change makes unnecessary the shutdown thread you added to avoid freezes (since the kernel is killed immediately, Spyder is not blocked by having to wait for it). Could you test that? Of course, that's for another PR, but I'm curious about it. |
The problem with that is that we don’t give any time to the kernel to try to shut down. The goal of my previous change was to give a little time (10s) to the kernel to shut down before killing it. |
That is what ipykernel is doing. check e.g. |
As far as I can tell, there are two ways to kill a kernel:
which ends up calling the The problem with that is that, on Windows and after creating a plot with Automatic backend, So, in the spyder/spyder/plugins/ipythonconsole/utils/manager.py Lines 58 to 75 in d49b92a
But for that, we need to use the Of course, another option would be to override |
If the kernel is killed directly, it doesn't have the opportunity to run any cleanup code (Any |
Is there a reason why |
Maybe we should override |
- This allows us to use the _kill_kernel method declared in SpyderKernelManager to correctly kill our own kernels. - This is necessary to kill not only the script that activates the conda environment associated to the kernel, but the kernel itself.
…automatic backend
fbef67b
to
21c129d
Compare
This comment has been minimized.
This comment has been minimized.
now
kwarg to the kernel manager shutdown method (IPython console)
@impact27, I followed your advice in my latest commits. Please take a look at this PR again and let me know what you think about it. |
This PR now reimplements We call Furthermore, when
So the interesting code path is finish_shutdown. The shutdown time is controlled by
|
bcdc2eb
to
4b66a3e
Compare
- Instead, give it some time to die by calling kill_proc_tree in _async_send_kernel_sigterm. - This was implemented per review.
4b66a3e
to
b7f8a9b
Compare
Ok, I restored the previous |
This is to avoids headaches when that major version is released.
…der-ide/spyder-kernels.git external-deps/spyder-kernels subrepo: subdir: "external-deps/spyder-kernels" merged: "ce13d9616" upstream: origin: "https://github.com/spyder-ide/spyder-kernels.git" branch: "2.x" commit: "ce13d9616" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596"
b7f8a9b
to
dab29a2
Compare
It looks good to me now. I wonder if killing rather than sending sigterm could produce issues but I can’t really |
Great! Thanks for your help reviewing this one.
Well, we send sigterm to the parent process and all its children here: spyder/spyder/plugins/ipythonconsole/utils/manager.py Lines 62 to 69 in dab29a2
( |
Description of Changes
Issue(s) Resolved
Fixes #17011
Fixes #14739
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct: @ccordoba12