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

net/http: Server.ReadTimeout closes connection before response is finished #15929

anacrolix opened this issue Jun 2, 2016 · 2 comments


Copy link

@anacrolix anacrolix commented Jun 2, 2016

The http.Server.ReadTimeout introduces a timeout for maximum time to consume a request from the wire. However upon completely reading a request, the next request is started, and times out, while the response for the previous request is still being written. This causes the connection to be closed, prematurely closing the ResponseWriter. Closing of the connection should be delayed until the active response is written, or better yet, the ReadTimeout should not begin until the active response is completed (since the connection is not idle).

@ianlancetaylor ianlancetaylor changed the title http.Server.ReadTimeout closes connection before response is finished net/http: Server.ReadTimeout closes connection before response is finished Jun 2, 2016
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Jun 2, 2016
Copy link

@bradfitz bradfitz commented Jun 29, 2016

We don't start reading the next request until your Handler is done and its output is flushed.

Got a demo program showing a repro? Is your ReadTimeout super short?

Copy link
Contributor Author

@anacrolix anacrolix commented Jul 7, 2016

I'm not able to reproduce it.

@anacrolix anacrolix closed this Jul 7, 2016
anacrolix added a commit to anacrolix/archive that referenced this issue Jul 7, 2016
@golang golang locked and limited conversation to collaborators Jul 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.