Pluto.jl icon indicating copy to clipboard operation
Pluto.jl copied to clipboard

Can't interrupt on Windows

Open fonsp opened this issue 4 years ago • 7 comments

This is because Distributed.interrupt always kills the process on Windows. I don't know why, I have spent some days on this interrupt stuff but it is beyond me. Maybe someone with experience in process signals can have a look?

Another solution is to not use Distributed anymore, #300

fonsp avatar Sep 18 '20 21:09 fonsp

I talked with @pfitzseb and he pointed out that only supporting the "soft interrupt", i.e.

schedule(running_task, InterruptException(); error=true)

is already quite nice! And relatively easy to implement

fonsp avatar Oct 20 '20 10:10 fonsp

FWIW, Windows doesn't have the same notion of signals as Unix, so you literally cannot send a SIGINT to a process. People usually default to killing the process outright, which probably is what you're seeing here.

pfitzseb avatar Oct 20 '20 11:10 pfitzseb

But the REPL can do it! It seems so close, yet so far 😪

fonsp avatar Oct 20 '20 17:10 fonsp

That's the same process though. But then again, I don't really understand how all of this works either ;)

pfitzseb avatar Oct 20 '20 17:10 pfitzseb

#932

fonsp avatar Feb 19 '21 22:02 fonsp

Is there any hope of resolving this? When working with long-running code on windows this is extremely frustrating.

FeldrinH avatar Jul 19 '21 18:07 FeldrinH

Can we make a workaround? Like disabling the cell such that when I reload the cell is not executed?

el-oso avatar Sep 16 '22 08:09 el-oso

Hey @fonsp! Hope this message finds you well. I just ran into this same problem (for similar reasons to #1568), came upon this issue as a result, and figured I might be able to help produce a fix.

It seems to me that, when you opened the issue, you had spent a decent amount of effort seeking the root cause. If any of that research has stuck with you, can you please share some of your findings?

ron-wolf avatar Sep 20 '23 18:09 ron-wolf

This needs (something like) https://github.com/JuliaLang/julia/pull/49541.

pfitzseb avatar Sep 21 '23 12:09 pfitzseb

We almost fixed it! See https://github.com/JuliaPluto/Malt.jl/pull/60

https://github.com/JuliaLang/julia/pull/49541 will be useful for handling interrupts more cleanly, eg the Ctrl+C signal to shut down Pluto, and we can make sure that interrupting the notebook will never interrupt Pluto/Malt internals. But the interrupt-on-windows issue is separate :)

fonsp avatar Sep 27 '23 15:09 fonsp

And @ron-wolf thanks so much for taking a look! This is really beyond my skillset and I feel crazy lucky that https://github.com/JuliaPluto/Malt.jl/pull/60 worked 😅

I would love to get your review on https://github.com/JuliaPluto/Malt.jl/pull/60! Finishing https://github.com/JuliaLang/julia/pull/49541 would also be useful for Pluto (including experimentation on how to best use the new API inside Pluto and Malt).


Another topic is the "hard interrupt" that you get by pressing Ctrl+C 5 times within one second. Pluto does this automatically when the first interrupt did not work, but it is a bit unstable. (Hence we are scared to add tests for it.) The main issue is that it sometimes keeps going for too long which kills the process, because we don't have a good way to check if the interrupt worked.

Code is here: https://github.com/fonsp/Pluto.jl/blob/v0.19.28/src/evaluation/WorkspaceManager.jl#L656-L690

I want to move this code from Pluto to Malt.interrupt_auto(worker), and get a more rigorous implementation and testing on the Malt side. I started this in https://github.com/JuliaPluto/Malt.jl/pull/60 but removed it again in a later commit.

Any help here would be super appreciated!

fonsp avatar Sep 27 '23 15:09 fonsp