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

Ctrl+C is not always caught #123

Closed
karlwessel opened this issue May 25, 2020 · 8 comments
Closed

Ctrl+C is not always caught #123

karlwessel opened this issue May 25, 2020 · 8 comments
Labels
help welcome If you are experienced in this topic - let us know! HTTP/WS The connection between backend and frontend

Comments

@karlwessel
Copy link
Contributor

I don't know it is really important since I wanted to stop Pluto anyway but when I stopped Pluto with CTRL+C the following error message appeared:

^C┌ Error: error handling request
│   exception =
│    InterruptException:
│    Stacktrace:
│     [1] poptaskref(::Base.InvasiveLinkedListSynchronized{Task}) at ./task.jl:702
│     [2] wait at ./task.jl:709 [inlined]
│     [3] wait(::Base.GenericCondition{Base.Threads.SpinLock}) at ./condition.jl:106
│     [4] wait_readnb(::Sockets.TCPSocket, ::Int64) at ./stream.jl:355
│     [5] eof at ./stream.jl:48 [inlined]
│     [6] eof(::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}) at /home/karl/.julia/packages/HTTP/GkPBm/src/ConnectionPool.jl:202
│     [7] eof at /home/karl/.julia/packages/HTTP/GkPBm/src/WebSockets.jl:237 [inlined]
│     [8] (::Pluto.var"#72#76")(::HTTP.WebSockets.WebSocket{HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}) at /home/karl/.julia/packages/Pluto/cvr89/src/webserver/WebServer.jl:132
│     [9] upgrade(::Pluto.var"#72#76", ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}; binary::Bool) at /home/karl/.julia/packages/HTTP/GkPBm/src/WebSockets.jl:146
│     [10] upgrade at /home/karl/.julia/packages/HTTP/GkPBm/src/WebSockets.jl:129 [inlined]
│     [11] (::Pluto.var"#71#75")(::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}) at /home/karl/.julia/packages/Pluto/cvr89/src/webserver/WebServer.jl:128
│     [12] handle at /home/karl/.julia/packages/HTTP/GkPBm/src/Handlers.jl:269 [inlined]
│     [13] #4 at /home/karl/.julia/packages/HTTP/GkPBm/src/Handlers.jl:345 [inlined]
│     [14] macro expansion at /home/karl/.julia/packages/HTTP/GkPBm/src/Servers.jl:367 [inlined]
│     [15] (::HTTP.Servers.var"#13#14"{HTTP.Handlers.var"#4#5"{HTTP.Handlers.StreamHandlerFunction{Pluto.var"#71#75"}},HTTP.ConnectionPool.Transaction{Sockets.TCPSocket},HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}})() at ./task.jl:358
└ @ HTTP.Servers ~/.julia/packages/HTTP/GkPBm/src/Servers.jl:373
@fonsp
Copy link
Owner

fonsp commented May 25, 2020

Hm yes this is a problem/feature with HTTP.jl, I don't think we can do much about it. You have to press Ctrl+C again in that case.

@fonsp
Copy link
Owner

fonsp commented May 25, 2020

This can be solved by overloading the HTTP.jl method that is causing this problem, or by submitting a PR to HTTP.jl to fix it directly.

I think that the try catch block that is printing this message should rethrow any errors that it does not expect, or at least the InterruptException. Just like the try catch block that comes before it. (But I don't know their project very well.)

@fonsp fonsp added enhancement New feature or request backend Concerning the julia server and runtime labels May 25, 2020
@karlwessel
Copy link
Contributor Author

If its nothing serious it doesn't matter so much. An error when trying to exit would only a problem if there is some clean up that would be interrupted by the error.

I have no problem pushing CTRL+C twice for now.

@fonsp fonsp changed the title Error when stopping Pluto Error messages from HTTP.jl May 26, 2020
@TheCedarPrince
Copy link
Contributor

Hey @fonsp, also have a mysterious error propagating.

When I tried running the same notebook twice, I got this error:

┌ Error: error handling request
│   exception =
│    IOError: stream is closed or unusable
│    Stacktrace:
│     [1] check_open at ./stream.jl:328 [inlined]
│     [2] uv_write_async(::Sockets.TCPSocket, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:961
│     [3] uv_write(::Sockets.TCPSocket, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:924
│     [4] unsafe_write(::Sockets.TCPSocket, ::Ptr{UInt8}, ::UInt64) at ./stream.jl:1007
│     [5] unsafe_write at /home/cedarprince/.julia/packages/HTTP/GkPBm/src/ConnectionPool.jl:174 [inlined]
│     [6] write at ./strings/io.jl:183 [inlined]
│     [7] closebody at /home/cedarprince/.julia/packages/HTTP/GkPBm/src/Streams.jl:113 [inlined]
│     [8] closewrite(::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}) at /home/cedarprince/.julia/packages/HTTP/GkPBm/src/Streams.jl:128
│     [9] (::HTTP.Servers.var"#13#14"{HTTP.Handlers.var"#4#5"{HTTP.Handlers.StreamHandlerFunction{Pluto.var"#71#75"}},HTTP.ConnectionPool.Transaction{Sockets.TCPSocket},HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}})() at ./task.jl:358
└ @ HTTP.Servers ~/.julia/packages/HTTP/GkPBm/src/Servers.jl:373

The reason why I clicked twice on a notebook was because I thought the notebook wasn't running. Maybe something got overloaded somewhere?

@fonsp
Copy link
Owner

fonsp commented May 28, 2020

Opening the same notebook twice is fine - you will get two synchronised clients on a shared session.

The error is exactly what I meant before - this is a non-error, and it would be nice to prevent HTTP.jl from printing it.

@fonsp fonsp added HTTP/WS The connection between backend and frontend and removed backend Concerning the julia server and runtime labels Jun 9, 2020
@fonsp
Copy link
Owner

fonsp commented Jun 16, 2020

I have submitted a PR to HTTP.jl to address this issue 🦈

@fonsp
Copy link
Owner

fonsp commented Jul 15, 2020

The common HTTP error messages are now gone (I added the PR fix from Pluto), but the problem that the issue started about is still there

@fonsp fonsp removed the enhancement New feature or request label Jul 15, 2020
@fonsp fonsp changed the title Error messages from HTTP.jl Ctrl+C is not always caught Jul 15, 2020
@fonsp fonsp added the help welcome If you are experienced in this topic - let us know! label Sep 4, 2020
@fonsp
Copy link
Owner

fonsp commented Sep 8, 2020

Should be fixed now

@fonsp fonsp closed this as completed Sep 8, 2020
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! HTTP/WS The connection between backend and frontend
Projects
None yet
Development

No branches or pull requests

3 participants