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

Cannot safely exit Pluto on Windows + git bash

Open tbeason opened this issue 3 years ago • 4 comments

Recently, meaning within the last few weeks, I cannot close Pluto anymore without experiencing a SEGFAULT. I use Windows Terminal + Git Bash for my Julia REPL experience and am on Windows 10. I start Julia, then import Pluto; Pluto.run() and Pluto runs without issue. When I am ready to close out, I return to the REPL and hit Ctrl+C. Nothing happens. If I continue to mash/hit Ctrl+C eventually I get

WARNING: Force throwing a SIGINT
Segmentation fault

https://user-images.githubusercontent.com/10752449/170730610-25425c0e-0245-488b-96a3-613b1b31bf0e.mp4

tbeason avatar May 27 '22 15:05 tbeason

What happens when you interrupt this code snippet?

➜  ~ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.7.0 (2021-11-30)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> try
           sleep(1000)
       catch e
           typeof(e)
       end
^CInterruptException

julia> 

fonsp avatar Jun 02 '22 22:06 fonsp

Same thing. Hmm. I do not recall having these problems when I interrupt other things at REPL.

tbeason avatar Jun 06 '22 13:06 tbeason

On MacOS, 1.8.0-rc1 Intel, ctrl-C does not interrupt safely anymore. An error that never recovers to terminal:

^Cfatal: error thrown and no exception handler available.
InterruptException()
ijl_task_get_next at /Applications/Julia-1.8.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.8.dylib (unknown line)
poptask at ./task.jl:919
wait at ./task.jl:928
task_done_hook at ./task.jl:632
jfptr_task_done_hook_28572.clone_1 at /Applications/Julia-1.8.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
ijl_apply_generic at /Applications/Julia-1.8.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.8.dylib (unknown line)
jl_finish_task at /Applications/Julia-1.8.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.8.dylib (unknown line)
start_task at /Applications/Julia-1.8.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.8.dylib (unknown line)
┌ Warning: Reading WebSocket client stream failed for unknown reason:
│   exception =
│    schedule: Task not runnable
│    Stacktrace:
│      [1] error(s::String)
│        @ Base ./error.jl:35
│      [2] schedule(t::Task, arg::Any; error::Bool)
│        @ Base ./task.jl:789
│      [3] schedule
│        @ ./task.jl:787 [inlined]
│      [4] uv_writecb_task(req::Ptr{Nothing}, status::Int32)
│        @ Base ./stream.jl:1161
│      [5] process_events
│        @ ./libuv.jl:104 [inlined]
│      [6] wait()
│        @ Base ./task.jl:930
│      [7] wait(c::Base.GenericCondition{Base.Threads.SpinLock})
│        @ Base ./condition.jl:124
│      [8] wait_readnb(x::Sockets.TCPSocket, nb::Int64)
│        @ Base ./stream.jl:416
│      [9] eof(s::Sockets.TCPSocket)
│        @ Base ./stream.jl:106
│     [10] eof(t::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket})
│        @ HTTP.ConnectionPool ~/.julia/packages/HTTP/aTjcj/src/ConnectionPool.jl:222
│     [11] eof
│        @ ~/.julia/packages/HTTP/aTjcj/src/WebSockets.jl:255 [inlined]
│     [12] (::Pluto.var"#401#413"{Pluto.ServerSession, Base.RefValue{Function}})(clientstream::HTTP.WebSockets.WebSocket{HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}})
│        @ Pluto ~/.julia/packages/Pluto/Bug7E/src/webserver/WebServer.jl:166
│     [13] upgrade(f::Pluto.var"#401#413"{Pluto.ServerSession, Base.RefValue{Function}}, http::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}; binary::Bool)
│        @ HTTP.WebSockets ~/.julia/packages/HTTP/aTjcj/src/WebSockets.jl:160
│     [14] upgrade
│        @ ~/.julia/packages/HTTP/aTjcj/src/WebSockets.jl:140 [inlined]
│     [15] (::Pluto.var"#400#412"{Pluto.ServerSession, HTTP.Handlers.Router{Symbol("##312")}, Base.RefValue{Function}})(http::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}})
│        @ Pluto ~/.julia/packages/Pluto/Bug7E/src/webserver/WebServer.jl:161
│     [16] handle
│        @ ~/.julia/packages/HTTP/aTjcj/src/Handlers.jl:270 [inlined]
│     [17] #4
│        @ ~/.julia/packages/HTTP/aTjcj/src/Handlers.jl:351 [inlined]
│     [18] macro expansion
│        @ ~/.julia/packages/HTTP/aTjcj/src/Servers.jl:415 [inlined]
│     [19] (::HTTP.Servers.var"#13#14"{HTTP.Handlers.var"#4#5"{HTTP.Handlers.StreamHandlerFunction{Pluto.var"#400#412"{Pluto.ServerSession, HTTP.Handlers.Router{Symbol("##312")}, Base.RefValue{Function}}}}, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, HTTP.Servers.Server{Nothing, Sockets.TCPServer}, HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}})()
│        @ HTTP.Servers ./task.jl:482
â”” @ Pluto ~/.julia/packages/Pluto/Bug7E/src/webserver/WebServer.jl:198



AshtonSBradley avatar Jun 07 '22 02:06 AshtonSBradley

Workaround for @tbeason:

I also run Pluto from gitbash under MSWindiws 10.

I start Pluto with

julia -e 'using Pluto: Pluto.run()' &

When I want to quit Pluto I use the jobs she'll command and then kill the Pluto job.

Looking at my shell history, it appears that recently I needed to include using Pkg; pkg.add("Pluto"); to the Julia command. I don't recall why.

MarkNahabedian avatar Jul 27 '22 12:07 MarkNahabedian

Just to update here. I've been using Windows Powershell as my default in Windows Terminal and still have this issue. So perhaps it is related to Windows Terminal and not the specific terminal "backend"?

tbeason avatar Aug 12 '22 13:08 tbeason

cc @savq

fonsp avatar Sep 01 '22 12:09 fonsp

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 avatar Sep 05 '22 12:09 fonsp

@Pangoraw did you say that this issue is related to the HTTP 1.0 release? Or was that something else?

fonsp avatar Sep 05 '22 12:09 fonsp