IJulia.jl
IJulia.jl copied to clipboard
Kernel not being stopped
I've noticed that when I stop using the IJulia notebook and then check running processes that the Julia kernel sticks around. My usage of IJulia typically involves running
ipython3 notebook --profile julia
from the command line, interacting with the notebook through the web interface, and using "Close and Halt" when I'm done with a notebook. Closing the notebook, the "gui" page (where you open new notebooks), or the console where the original command was run don't seem to make a difference in actually shutting down a Julia kernel instance.
Not sure if I'm doing something wrong here or if this is perhaps a windows only thing.
I see a couple processes still running on Linux, too.
If you open up the IPython dashboard (http://localhost:8998), does it say "Shutdown" next to any of the kernels? That would indicate that IPython has not shut them down.
(Did you launch additional Julia processes with addprocs?)
I was too quick on the last one. If I click shutdown then the julia kernel does shut down; it's only the ipython process that doesn't quit when I close the browser window. I suppose I should stop launching this with an & after the command, then I can use Ctrl-C to stop it.
I guess the places where I've noticed a julia kernel hanging around are cases where it had "crashed," like when I was testing graphics performance on line plots with many points.
"Close and halt" should stop the kernels, but not the tornado python process. THere is no way to stop the server from the webfrontend (yet)
I tried this a few more times and I'm seeing consistent results. Closing the notebook, choosing "Close and halt", clicking "Shutdown" or "Delete" even, none of these result in the Julia kernel being shutdown. The only way I've found to shutdown the kernel is closing the console from which I originally opened the notebook.
I can't replicate this. Clicking 'Shutdown' from the dashboard seems to reliably close the Julia process (as well as any processes created by running addprocs from the notebook). @karbarcca, is the problem still happening for you?
Yes, still happening. I haven't had a chance to dig or explore any more, but I still can only kill the julia process by stopping the ipython command line app (no shutdown/close & halt/etc work).
I ran into this little nugget perusing the IPython source:
FIXME: Shutdown does not work on Windows due to ZMQ errors!
if now or sys.platform == 'win32': if self.has_kernel: self._kill_kernel()
@minrk, can you comment on what is going on in those lines of manager.py?
If those lines apparently only work when the kernel manager and the kernel are the same process, I don't know if there's anything we can do about it in IJulia. Maybe file an IPython issue?
I don't know what's going on there. Presumably someone saw errors when trying the polite shutdown mechanism on Windows, and gave up on trying to fix it (as is our default pattern on Windows). It may not even be an issue anymore, I will check it out.
Thanks @minrk. All of the self.has_kernel conditionals in the kernel manager code might be worth revisiting, since those will never be true for the IJulia kernel.
Why would has_kernel ever be different for the Julia kernel?
I'm not sure if it's the same ZMQ error, but I've noticed in developing my own ZMQ backend for Sublime-IJulia that trying to destroy the ZMQ context seems to error silently. I haven't looked into it a ton, but that's what it made me think of when I saw "ZMQ errors".
Oh, I thought has_kernel meant that the manager and the kernel were running in the same process; I guess that's not what it means. In which case I don't understand why those lines would work for Python but not for Julia.
I have the same (a similar?) issue. I haven't tried to pinpoint what behavior causes it, but when I run top, I see seven julia processes, but in the "Running" tab there's only three. It's not new behavior, I just got tired of it this morning and went looking for a fix. Julia 1.0, Linux.