-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: data race reading a "Expect: 100-Continue" request while writing response #13050
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
Comments
CC @bradfitz |
Unlike the client code, the net/http Server code does not use different goroutines for reading vs. writing. Your Handler runs in the same goroutine that is reading the request (and request body) and writing the response (and response body). Can you share your code or a minimal repro? Are you using TimeoutHandler perhaps? |
The handler spawns a goroutine extra in order to handle streaming in a |
We should probably document the status quo for the past 5 years, that http.Handler's ResponseWriter should be written to from the same goroutine that that ServeHTTP was called from. |
I don't think the specific goroutine matters. What matters is that the ResponseWriter must not be written to after the handler returns. |
CL https://golang.org/cl/17982 mentions this issue. |
The goroutine reading the request body will be updating "ecr.sawEOF", while the goroutine writing the response will be reading that boolean with no synchronization.
Using
go1.5.1 windows/amd64
.The text was updated successfully, but these errors were encountered: