IOError: stream is closed or unusable
drrmmng opened this issue · 6 comments
When running the example app and refreshing it in the browser, I get the following 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/dario/.julia/packages/HTTP/facW7/src/ConnectionPool.jl:174 [inlined]
│ [6] macro expansion at ./gcutils.jl:91 [inlined]
│ [7] write at ./strings/io.jl:186 [inlined]
│ [8] writeheaders(::HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, ::HTTP.Messages.Response) at /home/dario/.julia/packages/HTTP/facW7/src/Messages.jl:439
│ [9] startwrite(::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}) at /home/dario/.julia/packages/HTTP/facW7/src/Streams.jl:85
│ [10] handle(::HTTP.Handlers.RequestHandlerFunction{Dashboards.var"#630#631"{Bool,Dash}}, ::HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}) at /home/dario/.julia/packages/HTTP/facW7/src/Handlers.jl:278
│ [11] #4 at /home/dario/.julia/packages/HTTP/facW7/src/Handlers.jl:345 [inlined]
│ [12] macro expansion at /home/dario/.julia/packages/HTTP/facW7/src/Servers.jl:367 [inlined]
│ [13] (::HTTP.Servers.var"#13#14"{HTTP.Handlers.var"#4#5"{HTTP.Handlers.RequestHandlerFunction{Dashboards.var"#630#631"{Bool,Dash}}},HTTP.ConnectionPool.Transaction{Sockets.TCPSocket},HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}})() at ./task.jl:333
└ @ HTTP.Servers ~/.julia/packages/HTTP/facW7/src/Servers.jl:373
It seems like an error with HTTP.jl as seen here JuliaWeb/HTTP.jl#392 but maybe you have an idea @waralex ?
Hi @federico can I get the example app where this error occurred? And what version of Julia are you using?
I can 't do anything if I don 't reproduce this error...
oh, I meant the example app in the documentation:
import HTTP
using Dashboards
app = Dash("Test app", external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]) do
html_div() do
html_h1("Hello Dashboards"),
html_div("Dashboards: Julia interface for Dash"),
dcc_graph(
id = "example-graph",
figure = (
data = [
(x = [1, 2, 3], y = [4, 1, 2], type = "bar", name = "SF"),
(x = [1, 2, 3], y = [2, 4, 5], type = "bar", name = "Montréal"),
],
layout = (title = "Dash Data Visualization",)
)
)
end
end
handler = make_handler(app, debug = true)
HTTP.serve(handler, HTTP.Sockets.localhost, 8080)
I'm using Julia 1.3.1
It does not reproduce on my computer. Can you show me a screenshot from the browser console with network tab when this happens?
In Google Chrome press Command+Option+J (Mac) or Control+Shift+J (Windows, Linux, Chrome OS), navigate to network tab and refresh the page:
I'm interesting on time of loading _dash-layout and _dash-dependencies. If it's the timeout, then I try to reproduce that by adding sleep() to server response...
I can't reproduce this error with Chromium, only with Firefox.
Also, the error is only thrown the first time the page is requested after a change to the code. This makes me think it has something to do with the precompilation of Julia.
Interestingly, when I use Chromium to first load the page, no error is thrown, not even when I load the page with Firefox afterwards.
I can't reproduce it yet :(
It's probably an issue with HTTP.jl and not Dashboards.jl anyway 🤔