Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exiting Pluto seems broken #2229

Closed
ForceBru opened this issue Jul 26, 2022 · 5 comments · Fixed by #2293
Closed

Exiting Pluto seems broken #2229

ForceBru opened this issue Jul 26, 2022 · 5 comments · Fixed by #2293
Labels
help welcome If you are experienced in this topic - let us know!

Comments

@ForceBru
Copy link

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
@disberd
Copy link
Contributor

disberd commented Jul 27, 2022

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

@rikhuijzer
Copy link
Collaborator

Seems like a duplicate of #2136.

@disberd
Copy link
Contributor

disberd commented Jul 27, 2022

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

@Pangoraw Pangoraw added the help welcome If you are experienced in this topic - let us know! label Aug 11, 2022
@wl44-li
Copy link

wl44-li commented Aug 29, 2022

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

@adcsilva
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help welcome If you are experienced in this topic - let us know!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants