tlienart / Franklin.jl

(yet another) static site generator. Simple, customisable, fast, maths with KaTeX, code evaluation, optional pre-rendering, in Julia.
https://franklinjl.org
MIT License
963 stars 114 forks source link

IOError: stream is closed or unusable #773

Closed cscherrer closed 3 years ago

cscherrer commented 3 years ago

This pops up often:

✓ LiveServer listening on http://localhost:8000/ ...
  (use CTRL+C to shut down)
→ page updated [✓]                                                                    ┌ Error: error handling request
│   exception =
│    IOError: stream is closed or unusable
│    Stacktrace:
│      [1] check_open
│        @ ./stream.jl:386 [inlined]
│      [2] uv_write_async(s::Sockets.TCPSocket, p::Ptr{UInt8}, n::UInt64)
│        @ Base ./stream.jl:1018
│      [3] uv_write(s::Sockets.TCPSocket, p::Ptr{UInt8}, n::UInt64)
│        @ Base ./stream.jl:981
│      [4] unsafe_write(s::Sockets.TCPSocket, p::Ptr{UInt8}, n::UInt64)
│        @ Base ./stream.jl:1064
│      [5] unsafe_write
│        @ ~/.julia/packages/HTTP/IAI92/src/ConnectionPool.jl:171 [inlined]
│      [6] write
│        @ ./strings/io.jl:185 [inlined]
│      [7] write
│        @ ./io.jl:639 [inlined]
│      [8] unsafe_write(http::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}, p::Ptr{UInt8}, n::UInt64)
│        @ HTTP.Streams ~/.julia/packages/HTTP/IAI92/src/Streams.jl:100
│      [9] unsafe_write
│        @ ./io.jl:646 [inlined]
│     [10] write
│        @ ./io.jl:669 [inlined]
│     [11] handle(::HTTP.Handlers.RequestHandlerFunction{LiveServer.var"#10#15"{Bool, LiveServer.SimpleWatcher}}, ::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}})
│        @ HTTP.Handlers ~/.julia/packages/HTTP/IAI92/src/Handlers.jl:279
│     [12] (::LiveServer.var"#12#17"{HTTP.Handlers.RequestHandlerFunction{LiveServer.var"#10#15"{Bool, LiveServer.SimpleWatcher}}})(http::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}})
│        @ LiveServer ~/.julia/packages/LiveServer/4Y1VV/src/server.jl:300
│     [13] macro expansion
│        @ ~/.julia/packages/HTTP/IAI92/src/Servers.jl:367 [inlined]
│     [14] (::HTTP.Servers.var"#13#14"{LiveServer.var"#12#17"{HTTP.Handlers.RequestHandlerFunction{LiveServer.var"#10#15"{Bool, LiveServer.SimpleWatcher}}}, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}})()
│        @ HTTP.Servers ./task.jl:406
└ @ HTTP.Servers ~/.julia/packages/HTTP/IAI92/src/Servers.jl:373

Nothing seems to crash, but I thought you ought to know about it. Maybe you already do?

tlienart commented 3 years ago

Yes, this is unrelated to Franklin but is related to LiveServer and more specifically to HTTP.jl. See also https://franklinjl.org/faq/troubleshooting/#not-juno

One thing that seems to cause this is when you open multiple tabs pointing to localhost and refresh some of them, or close some of them. We're not quite sure.

xref:

We could try to hid it in LS but it's not easily reproducible.

Anyway long story short is you can ignore it

(Note: if you have a set of actions that reproduces the error, I'll be glad to know, as this might help hide it).

fredrikekre commented 3 years ago

Fixed (hidden) by https://github.com/JuliaWeb/HTTP.jl/pull/546 ?

tlienart commented 3 years ago

^ I still see it from time to time and I have HTTP 0.9.2 (the PR you mention was merged in 0.9.1), also fonsp kindly made a PR to LiveServer with that change (https://github.com/tlienart/LiveServer.jl/commit/21cef699c387f07d81f5b96acbe1e379c68354a1) but to the best of my knowledge it doesn't eliminate the problem (though it likely helps)

@cscherrer could you report which version of HTTP you're on?

cscherrer commented 3 years ago

HTTP v0.8.19

tlienart commented 3 years ago

Ah well so then the situation is definitely worse. Maybe you have another package that blocks you from updating HTTP to 0.9+? The situation should be better with that version