JuliaLang / IJulia.jl

Julia kernel for Jupyter
MIT License
2.81k stars 413 forks source link

Can't terminate `notebook()` function in Julia REPL in 1.8 on Windows #1048

Open nilshg opened 2 years ago

nilshg commented 2 years ago

In 1.7.3 I can do:

julia> using IJulia

julia> notebook()
[ Info: running setenv(...)

# Single Ctrl+C

Process(setenv(..., ProcessSignaled(2))

julia> 

In 1.8-rc3 this doesn't work (tested on both cmd.exe and powershell):

julia> using IJulia

julia> notebook()
[ Info: running setenv(...)

# Single Ctrl+C

# Nothing happens

# Multiple Ctrl+Cs

WARNING: Force throwing a SIGINT

and the whole Julia session is dead.

nilshg commented 2 years ago

Edited to add that this isn't fixed by using 1.8 stable release. There's a related Pluto issue here: https://github.com/fonsp/Pluto.jl/issues/2136

benz0li commented 2 years ago

Some slightly different results for Debian 11 (bullseye):

Julia 1.8.0, JupyterLab Terminal

julia> using IJulia

julia> notebook()
[ Info: running `/usr/local/bin/jupyter notebook`
^C^C^C^C^C^CWARNING: Force throwing a SIGINT
Process(setenv(`/usr/local/bin/jupyter notebook`; dir="/home/benz0li"), ProcessExited(0))

julia>

Julia 1.8.0, code-server (aka VS Code) Terminal, Julia REPL

julia> using IJulia

julia> notebook()
[ Info: running `/usr/local/bin/jupyter notebook`
^C
Process(setenv(`/usr/local/bin/jupyter notebook`; dir="/home/benz0li"), ProcessExited(0))

julia>

ℹ️ May be reproduced at https://demo.jupyter.b-data.ch or with docker run --rm -it -p 8888:8888 registry.gitlab.b-data.ch/jupyterlab/julia/pubtools

fonsp commented 2 years ago

I opened a Julia issue about a change in interrupt behaviour on Julia 1.8, which I suspect to be the cause here.

https://github.com/JuliaLang/julia/issues/46635

So far I only have my result on MacOS, perhaps someone using a different OS could try to reproduce the issue, and leave a comment with their versioninfo()?

fonsp commented 2 years ago

In Pluto, we were able to work around this issue, see https://github.com/fonsp/Pluto.jl/pull/2293 , maybe the same technique would also work for IJulia! See https://github.com/JuliaLang/julia/issues/46635 for a discussion about this workaround and alternatives.