JuliaLang / IJulia.jl

Julia kernel for Jupyter
MIT License
2.78k stars 409 forks source link

Interrupt & Restart buttons do not work for Julia on jupyter #1052

Open jaepillee0315 opened 2 years ago

jaepillee0315 commented 2 years ago

When I click the restart/stop button in jupyter while a code block is running, the timer on the running cell does not stop and I simply cannot rerun the ipynb file. "Go to running cell" still shows that the code block is running. I just have to close VSCode to start over. ^c does not work, either.

As you can see, Jupyter server is hung when I try to interrupt kernel execution.

info 10:4:56.174: Interrupt kernel execution
info 10:4:56.174: Cancel pending cells
info 10:4:56.174: Interrupting kernel: julia-1.7
info 10:4:56.174: Interrupting kernel with a shell message
warn 10:5:6.189: Error during interrupt: Error: Kernel interrupt failed. Jupyter server is hung. Please reload VS Code.

The stop button works fine in Jupyter Notebook, but a similar problem persists in the Jupyterlab application. When I click 'stop', Jupyter Notebook returns InterruptException:, but the kernel stays 'busy'. When I try to run other cells, the kernel does not do anything.

Take a look at https://github.com/microsoft/vscode-jupyter/issues/10328 The VS code manager I talked to in the issue agrees that the server is hung when I try to stop the code, and the person suspects it may be an issue with the Julia kernel not working well with jupyter notebooks.

I posted this issue on /julia-vscode and /vscode-jupyter, but based on the responses I get, it looks like the issue is in IJulia.

Willem-Mazzotti-P commented 1 year ago

Hi, I am having the same issue. The stop button works in a jupyter notebook with Python kernel.

VSCode Version

1.74.3

Jupyter Extension Version

v2022.11.1003412109

Coding Language and Runtime Version

Julia 1.7.3

Julia VS code extension

v1.38.2

IJulia

IJulia v1.24.0

pitipatw commented 7 months ago

Hi, I am also having the same problem when running Julia on a Jupyter notebook, i.e. when running a code, let say it stuck in a loop, I can't stop or restart it using Jupyter's "Restart" and "Stop" buttons. Pressing those buttons does nothing, the script will keep running.

I am using Julia 1.9.2 VScode Julia extension v1.47.2 Juypter notebook extension v2022.8.1002431955

The satisfying way to get around this is to close VScode entirely and restart the whole process.

The workaround, I'm not sure if this is right,

  1. Stop the notebook from the Julia Extension on the left side of the VScode. (This will not stop the running block.)
  2. Make a copy of the running block.
  3. Delete the running block
  4. Run the whole code again. (Since you can't stop the running block, but entire notebook)

Im not sure if this will just the display issue between Julia and Jupyter notebook, but it is definitely worth taking a look for a smoother experience between Julia and Jupyter notebook.

hbsmith commented 2 months ago

Is there any progress on this? It's super frustrating to have to restart the entire Julia extension whenever I want to interrupt a cell.

pitipatw commented 2 months ago

Is there any progress on this? It's super frustrating to have to restart the entire Julia extension whenever I want to interrupt a cell.

It's still happening, I stopped using Jupyter and use begin-end instead.