-
Notifications
You must be signed in to change notification settings - Fork 18.1k
net/http: TimeoutHandler panics with concurrent requests #8209
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
Labels
Milestone
Comments
Comment 2 by [email protected]: I've created a gist that can reproduce the issue without high concurrency. https://gist.github.com/partkyle/404b3d305e69ea11172e |
Owner changed to @bradfitz. Status changed to Accepted. |
CL https://golang.org/cl/123610043 mentions this issue. |
This issue was closed by revision e38fa91. Status changed to Fixed. |
Hi, I'm sorry, I replied to the code review :P The TimeoutHandler will still suffer from a race if the guarded handler modifies the Header. Created a slight modification to the test: diff -r 493ad916c3b1 src/net/http/serve_test.go --- a/src/net/http/serve_test.go Sun Nov 23 15:13:48 2014 -0500 +++ b/src/net/http/serve_test.go Mon Nov 24 15:50:11 2014 +0100 @@ -1171,6 +1171,7 @@ sendHi := make(chan bool, 1) writeErrors := make(chan error, 1) sayHi := HandlerFunc(func(w ResponseWriter, r *Request) { + w.Header().Set("Content-Type", "text/plain") <-sendHi _, werr := w.Write([]byte("hi")) writeErrors <- werr Assuming a handler modifies the header before timing out. This will lead to a data race. |
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jun 25, 2018
The existing lock needed to be held longer. If a timeout occured while writing (but after the guarded timeout check), the writes would clobber a future connection's buffer. Also remove a harmless warning by making Write also set the flag that headers were sent (implicitly), so we don't try to write headers later (a no-op + warning) on timeout after we've started writing. Fixes golang#8414 Fixes golang#8209 LGTM=ruiu, adg R=adg, ruiu CC=golang-codereviews https://golang.org/cl/123610043
wheatman
pushed a commit
to wheatman/go-akaros
that referenced
this issue
Jul 9, 2018
The existing lock needed to be held longer. If a timeout occured while writing (but after the guarded timeout check), the writes would clobber a future connection's buffer. Also remove a harmless warning by making Write also set the flag that headers were sent (implicitly), so we don't try to write headers later (a no-op + warning) on timeout after we've started writing. Fixes golang#8414 Fixes golang#8209 LGTM=ruiu, adg R=adg, ruiu CC=golang-codereviews https://golang.org/cl/123610043
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by vzdravevski:
The text was updated successfully, but these errors were encountered: