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

Exiting Pluto seems broken

Open ForceBru opened this issue 1 year ago • 3 comments

How to reproduce

  1. In the current notebook, click on the Pluto logo to go back to the main page
  2. Shut down all running notebooks from that page
  3. In the terminal, press Ctrl+C
  4. ...
  5. For me, nothing happens, for tens of seconds, until I'm tired of waiting and press Ctrl+C again.
  6. Error appears (see below), but the process is still running (I don't get back to the shell or the REPL). It's been like this for a couple of minutes now...
  7. I press Ctrl+C again and again, but nothing happens.
  8. I start spamming Ctrl+C. The terminal says: WARNING: Force throwing a SIGINT
  9. The usual Pluto's goodbye appears, I drop back to Julia REPL, all good.

I wouldn't say this is very well-reproducible, but it happens pretty consistently for me. In the example below I use threads, but it happens without threads too.

Error message

julia> import Pluto; Pluto.run(launch_browser=false, threads=2)
[ Info: Loading...
┌ Info: 
â”” Go to http://localhost:1234/?secret=reN0XLZq in your browser to start writing ~ have fun!
┌ Info: 
│ Press Ctrl+C in this terminal to stop Pluto
â”” 
^C^Cfatal: error thrown and no exception handler available.
InterruptException()
ijl_task_get_next at /Users/forcebru/Desktop/Julia/Julia-1.8.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.8.dylib (unknown line)
poptask at ./task.jl:921
wait at ./task.jl:930
task_done_hook at ./task.jl:634
jfptr_task_done_hook_32329.clone_1 at /Users/forcebru/Desktop/Julia/Julia-1.8.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
ijl_apply_generic at /Users/forcebru/Desktop/Julia/Julia-1.8.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.8.dylib (unknown line)
jl_finish_task at /Users/forcebru/Desktop/Julia/Julia-1.8.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.8.dylib (unknown line)
start_task at /Users/forcebru/Desktop/Julia/Julia-1.8.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.8.dylib (unknown line)
┌ Warning: temp cleanup
│   exception =
│    schedule: Task not runnable
│    Stacktrace:
│      [1] error(s::String)
│        @ Base ./error.jl:35
│      [2] enq_work(t::Task)
│        @ Base ./task.jl:718
│      [3] yield
│        @ ./task.jl:833 [inlined]
│      [4] yield
│        @ ./task.jl:831 [inlined]
│      [5] Channel{Tuple{String, Vector{String}, Vector{String}}}(func::Base.Filesystem.var"#28#31"{String}, size::Int64; taskref::Nothing, spawn::Bool)
│        @ Base ./channels.jl:140
│      [6] Channel (repeats 2 times)
│        @ ./channels.jl:132 [inlined]
│      [7] #walkdir#27
│        @ ./file.jl:967 [inlined]
│      [8] prepare_for_deletion(path::String)
│        @ Base.Filesystem ./file.jl:511
│      [9] temp_cleanup_purge(; force::Bool)
│        @ Base.Filesystem ./file.jl:546
│     [10] (::Base.var"#886#887")()
│        @ Base ./initdefs.jl:351
│     [11] _atexit()
│        @ Base ./initdefs.jl:372
â”” @ Base.Filesystem file.jl:551
┌ 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:791
│      [3] schedule
│        @ ./task.jl:789 [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:932
│      [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] (::Base.var"#wait_locked#680")(s::Sockets.TCPSocket, buf::IOBuffer, nb::Int64)
│        @ Base ./stream.jl:944
│     [10] unsafe_read(s::Sockets.TCPSocket, p::Ptr{UInt8}, nb::UInt64)
│        @ Base ./stream.jl:950
│     [11] unsafe_read(c::HTTP.ConnectionPool.Connection, p::Ptr{UInt8}, n::UInt64)
│        @ HTTP.ConnectionPool ~/.julia/packages/HTTP/XJG1J/src/ConnectionPool.jl:173
│     [12] unsafe_read
│        @ ./io.jl:759 [inlined]
│     [13] unsafe_read(s::HTTP.ConnectionPool.Connection, p::Base.RefValue{UInt16}, n::Int64)
│        @ Base ./io.jl:758
│     [14] read!
│        @ ./io.jl:760 [inlined]
│     [15] read
│        @ ./io.jl:764 [inlined]
│     [16] readframe(io::HTTP.ConnectionPool.Connection, ::Type{HTTP.WebSockets.Frame}, buffer::Vector{UInt8}, first_fragment_opcode::HTTP.WebSockets.OpCode)
│        @ HTTP.WebSockets ~/.julia/packages/HTTP/XJG1J/src/WebSockets.jl:128
│     [17] readframe
│        @ ~/.julia/packages/HTTP/XJG1J/src/WebSockets.jl:127 [inlined]
│     [18] receive(ws::HTTP.WebSockets.WebSocket)
│        @ HTTP.WebSockets ~/.julia/packages/HTTP/XJG1J/src/WebSockets.jl:658
│     [19] iterate(ws::HTTP.WebSockets.WebSocket, st::Nothing)
│        @ HTTP.WebSockets ~/.julia/packages/HTTP/XJG1J/src/WebSockets.jl:697
│     [20] (::Pluto.var"#392#402"{Pluto.ServerSession})(clientstream::HTTP.WebSockets.WebSocket)
│        @ Pluto ~/.julia/packages/Pluto/QSbSE/src/webserver/WebServer.jl:197
│     [21] upgrade(f::Pluto.var"#392#402"{Pluto.ServerSession}, http::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Connection}; suppress_close_error::Bool, maxframesize::Int64, maxfragmentation::Int64, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
│        @ HTTP.WebSockets ~/.julia/packages/HTTP/XJG1J/src/WebSockets.jl:439
│     [22] upgrade
│        @ ~/.julia/packages/HTTP/XJG1J/src/WebSockets.jl:419 [inlined]
│     [23] (::Pluto.var"#391#401"{Pluto.ServerSession, HTTP.Handlers.Router{typeof(HTTP.Handlers.default404), typeof(HTTP.Handlers.default405), Nothing}})(http::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Connection})
│        @ Pluto ~/.julia/packages/Pluto/QSbSE/src/webserver/WebServer.jl:171
│     [24] #invokelatest#2
│        @ ./essentials.jl:729 [inlined]
│     [25] invokelatest
│        @ ./essentials.jl:726 [inlined]
│     [26] handle_connection(f::Function, c::HTTP.ConnectionPool.Connection, listener::HTTP.Servers.Listener{Nothing, Sockets.TCPServer}, readtimeout::Int64, access_log::Nothing)
│        @ HTTP.Servers ~/.julia/packages/HTTP/XJG1J/src/Servers.jl:446
│     [27] (::HTTP.Servers.var"#16#17"{Pluto.var"#391#401"{Pluto.ServerSession, HTTP.Handlers.Router{typeof(HTTP.Handlers.default404), typeof(HTTP.Handlers.default405), Nothing}}, HTTP.Servers.Listener{Nothing, Sockets.TCPServer}, Set{HTTP.ConnectionPool.Connection}, Int64, Nothing, Base.Semaphore, HTTP.ConnectionPool.Connection})()
│        @ HTTP.Servers ./task.jl:484
â”” @ Pluto ~/.julia/packages/Pluto/QSbSE/src/webserver/WebServer.jl:203

Versions

  • Julia 1.8.0-rc3
  • Pluto v0.19.10
  • macOS 10.15.7

ForceBru avatar Jul 26 '22 21:07 ForceBru

I do confirm that this is the usual way I shut down Pluto since a long time, by spamming Ctrl+C until the julia session returns after a lot of errors as mentioned by @ForceBru. I just adapted to it but it would indeed be nice if it would work with a single Ctrl+C 😄

Edit: I am on windows

disberd avatar Jul 27 '22 10:07 disberd

Seems like a duplicate of #2136.

rikhuijzer avatar Jul 27 '22 10:07 rikhuijzer

It does seem indeed, though the title of #2136 is too restrictive as it also seem to happen on MacOS and I am on windows but not through Git Bash

disberd avatar Jul 27 '22 10:07 disberd

I have been experiencing very similar issues on M2 Mac, using the latest 1.8 Julia.

julia> using Pluto

julia> Pluto.run()
[ Info: Loading...
┌ Info: 
â”” Opening http://localhost:1235/?secret=ouGyaIDp in your default browser... ~ have fun!
┌ Info: 
│ Press Ctrl+C in this terminal to stop Pluto
â”” 
^C^C^X^C^C^C^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:921
wait at ./task.jl:930
task_done_hook at ./task.jl:634
jfptr_task_done_hook_58950 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: temp cleanup
│   exception =
│    schedule: Task not runnable
│    Stacktrace:
│      [1] error(s::String)
│        @ Base ./error.jl:35
│      [2] enq_work(t::Task)
│        @ Base ./task.jl:718
│      [3] yield
│        @ ./task.jl:833 [inlined]
│      [4] yield
│        @ ./task.jl:831 [inlined]
│      [5] Channel{Tuple{String, Vector{String}, Vector{String}}}(func::Base.Filesystem.var"#28#31"{String}, size::Int64; taskref::Nothing, spawn::Bool)
│        @ Base ./channels.jl:140
│      [6] Channel (repeats 2 times)
│        @ ./channels.jl:132 [inlined]
│      [7] #walkdir#27
│        @ ./file.jl:967 [inlined]
│      [8] prepare_for_deletion(path::String)
│        @ Base.Filesystem ./file.jl:511
│      [9] temp_cleanup_purge(; force::Bool)
│        @ Base.Filesystem ./file.jl:546
│     [10] (::Base.var"#885#886")()
│        @ Base ./initdefs.jl:351
│     [11] _atexit()
│        @ Base ./initdefs.jl:372
â”” @ Base.Filesystem file.jl:551
┌ 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:791
│      [3] schedule
│        @ ./task.jl:789 [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:932
│      [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] (::Base.var"#wait_locked#679")(s::Sockets.TCPSocket, buf::IOBuffer, nb::Int64)
│        @ Base ./stream.jl:944
│     [10] unsafe_read(s::Sockets.TCPSocket, p::Ptr{UInt8}, nb::UInt64)
│        @ Base ./stream.jl:950
│     [11] unsafe_read(c::HTTP.ConnectionPool.Connection, p::Ptr{UInt8}, n::UInt64)
│        @ HTTP.ConnectionPool ~/.julia/packages/HTTP/4Xalq/src/ConnectionPool.jl:173
│     [12] unsafe_read
│        @ ./io.jl:759 [inlined]
│     [13] unsafe_read(s::HTTP.ConnectionPool.Connection, p::Base.RefValue{UInt16}, n::Int64)
│        @ Base ./io.jl:758
│     [14] read!
│        @ ./io.jl:760 [inlined]
│     [15] read
│        @ ./io.jl:764 [inlined]
│     [16] readframe(io::HTTP.ConnectionPool.Connection, ::Type{HTTP.WebSockets.Frame}, buffer::Vector{UInt8}, first_fragment_opcode::HTTP.WebSockets.OpCode)
│        @ HTTP.WebSockets ~/.julia/packages/HTTP/4Xalq/src/WebSockets.jl:128
│     [17] readframe
│        @ ~/.julia/packages/HTTP/4Xalq/src/WebSockets.jl:127 [inlined]
│     [18] receive(ws::HTTP.WebSockets.WebSocket)
│        @ HTTP.WebSockets ~/.julia/packages/HTTP/4Xalq/src/WebSockets.jl:658
│     [19] iterate(ws::HTTP.WebSockets.WebSocket, st::Nothing)
│        @ HTTP.WebSockets ~/.julia/packages/HTTP/4Xalq/src/WebSockets.jl:697
│     [20] (::Pluto.var"#393#403"{Pluto.ServerSession})(clientstream::HTTP.WebSockets.WebSocket)
│        @ Pluto ~/.julia/packages/Pluto/rBF1P/src/webserver/WebServer.jl:197
│     [21] upgrade(f::Pluto.var"#393#403"{Pluto.ServerSession}, http::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Connection}; suppress_close_error::Bool, maxframesize::Int64, maxfragmentation::Int64, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
│        @ HTTP.WebSockets ~/.julia/packages/HTTP/4Xalq/src/WebSockets.jl:439
│     [22] upgrade
│        @ ~/.julia/packages/HTTP/4Xalq/src/WebSockets.jl:419 [inlined]
│     [23] (::Pluto.var"#392#402"{Pluto.ServerSession, HTTP.Handlers.Router{typeof(Pluto.default_404), typeof(HTTP.Handlers.default405), Nothing}})(http::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Connection})
│        @ Pluto ~/.julia/packages/Pluto/rBF1P/src/webserver/WebServer.jl:171
│     [24] #invokelatest#2
│        @ ./essentials.jl:729 [inlined]
│     [25] invokelatest
│        @ ./essentials.jl:726 [inlined]
│     [26] handle_connection(f::Function, c::HTTP.ConnectionPool.Connection, listener::HTTP.Servers.Listener{Nothing, Sockets.TCPServer}, readtimeout::Int64, access_log::Nothing)
│        @ HTTP.Servers ~/.julia/packages/HTTP/4Xalq/src/Servers.jl:446
│     [27] (::HTTP.Servers.var"#16#17"{Pluto.var"#392#402"{Pluto.ServerSession, HTTP.Handlers.Router{typeof(Pluto.default_404), typeof(HTTP.Handlers.default405), Nothing}}, HTTP.Servers.Listener{Nothing, Sockets.TCPServer}, Set{HTTP.ConnectionPool.Connection}, Int64, Nothing, Base.Semaphore, HTTP.ConnectionPool.Connection})()
│        @ HTTP.Servers ./task.jl:484
â”” @ Pluto ~/.julia/packages/Pluto/rBF1P/src/webserver/WebServer.jl:203

wl44-li avatar Aug 29 '22 19:08 wl44-li

The same is happening with me. Nothing happens when I press ^C on the command window. I force close the terminal window and the browser to close the session. I am using Windows 11. Julia 1.8.1. The same happens under Firefox and Edge. Pluto01

Pluto02

adcsilva avatar Sep 15 '22 16:09 adcsilva