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

What is "Server never wrote a response" ? #643

Closed
fonsp opened this issue Dec 11, 2020 · 2 comments
Closed

What is "Server never wrote a response" ? #643

fonsp opened this issue Dec 11, 2020 · 2 comments

Comments

@fonsp
Copy link
Member

fonsp commented Dec 11, 2020

Julia 1.5.3
HTTP.jl 0.9.1

Pluto started printing a new error message since the HTTP 0.9.1 update:

┌ Error: error handling request
│   exception =
│    Server never wrote a response
│    Stacktrace:
│     [1] error(::String) at ./error.jl:33
│     [2] macro expansion at /Users/fons/.julia/packages/HTTP/FV5cL/src/Servers.jl:406 [inlined]
│     [3] (::HTTP.Servers.var"#13#14"{HTTP.Handlers.var"#4#5"{HTTP.Handlers.StreamHandlerFunction{Pluto.var"#213#223"{Pluto.ServerSession,HTTP.Handlers.Router{Symbol("##253")},Base.RefValue{Function}}}},HTTP.ConnectionPool.Transaction{Sockets.TCPSocket},HTTP.Streams.Stream{HTTP.Messages.Request,HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}})() at ./task.jl:356
└ @ HTTP.Servers ~/.julia/packages/HTTP/FV5cL/src/Servers.jl:413

Why is this an error? Can I disable this message? I also can't tell which request this error is about, so it's difficult for me to fix. I will limit Pluto to HTTP 0.9.0 as a workaround

You can reproduce this error by using the version of Pluto before I set the 0.9.0 limit:

pkg> add Pluto#a01a6e70466292420517533767e9cbc781b3b9ef
@fonsp fonsp changed the title New error message in 0.9.1 What is "Server never wrote a response" ? Dec 11, 2020
@fonsp
Copy link
Member Author

fonsp commented Dec 11, 2020

It looks like this is happening for every new WebSocket connection. The error is false: HTTP.jl writes a response to the HTTP upgrade request:

startwrite(http)

@staticfloat

@fonsp
Copy link
Member Author

fonsp commented Dec 17, 2020

@staticfloat helped me fix the problem:

In my case, we check each incoming connection whether it is authenticated. For simple HTTP endpoints, we respond with a 403 error page if it is not.

The problem was the "protocol upgrade" request for establishing a websocket connection. Here we checked for authentication, and if not, we did not write a response to the upgrade request. The solution is tricky, you need to manually write the response:

fonsp/Pluto.jl@163a507#diff-c838b67ba58bb2ea21d4a739b4d8b1930559595218dd045fa2785fb0f4dbbc60R196-R198

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant