Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Can not stop "ipython kernel" on windows #2049

Closed
jstenar opened this Issue Jun 28, 2012 · 10 comments

Comments

Projects
None yet
7 participants
Member

jstenar commented Jun 28, 2012

when running the "ipython kernel" command on windows I can not stop the kernel process. Ctrl-c does not stop the process like it does when using "ipython notebook". I have to kill the process manually using the process explorer.

Owner

minrk commented Jun 28, 2012

Not windows specific, and also not so much a bug as an annoying feature. If we allowed sigint to terminate a kernel, then interrupting it from the notebook or qtconsole would occasionally appear as a crash.

Contributor

joonro commented Dec 13, 2012

I am not sure if this is the same problem I have. I started a kernel with IPython.embed_kernel(), and I cannot kill it. I'm using linux and ctrl + c does not work.

Owner

minrk commented Jan 20, 2013

^C should not terminate the process, because ^C must be interpreted as a regular sigint and raise KeyboardInterrupt in user code. We don't want ^C to kill the kernel, because then if a user tries to interrupt their own code, the kernel will die. We used to allow ^C to kill the kernel while user code was not running, but this still allowed accidental kernel shutdown if you tried to interrupt your own code, but ended up sending the signal after your code finished. The only sensible answer is for kernels to not be killed by ^C.

We could, however, change the ipython kernel entry point to, instead of launching the kernel directly, start a minimal KernelManager, which in turn starts the actual Kernel. If we did this, then you could interrupt the KernelManager directly with ^C, which would in turn cleanup the kernel.

idbrii commented Feb 17, 2013

Is the only way to kill ipython kernel to send it a sigterm?

Owner

minrk commented Feb 17, 2013

@pydave or ask it to shutdown from a frontend.

Owner

ivanov commented Jul 24, 2013

arg! i just spent a half hour trying to figure out where i should make some changes to make this work... :\

ivanov added a commit to ivanov/ipython that referenced this issue Jul 24, 2013

@ivanov ivanov closed this in #3753 Jul 25, 2013

lithp commented Nov 20, 2013

@minrk I've tried my best to google but can't seem to find it. How do you ask it to shutdown from a frontend?

Owner

minrk commented Nov 20, 2013

If it's a terminal client, you can type exit. Or you can connect a KernelClient object, and call client.shutdown()

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

@minrk thanks for the explanation. However now that you have shown why ctrl-c does not work, how do I stop the script?

Ok! My bad. I just found out because I had set 'debug = True' it was reloading my script continuously, that's why I wasn't able to stop it. Ctrl-c worked for me, on the regular console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment