-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: data race in closing and reading from expectContinueReader () #26253
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
I'm going to try to come up with code that matches your description, but it would really speed things up if you can submit standalone runnable code.
thanks! |
expectContinueReader struct has a race between methods Close and Read when accessing unprotected boolean "closed"
and
Is this race expected? Is there any safe way to abort http transfer on server side in net/http package? |
Thanks for the code. (I now see how obvious this was from your first comment.) Can easily recreate this race by inserting
into I suppose an obvious band aid is to use a mutex. If sync.Mutex locking without contention implementation is fast (e.g. futex) then sync.Mutex should be fine.
Can you elaborate more on what this
I assume you've seen |
I believe this issue is similar to #6995 (which is ancient). In If there are future implementations of |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
We are seeing this in a reverse proxy under load on Go 1.12.4. Is there even a way to patch around this locally without fixing it in the core
|
What version of Go are you using (
go version
)?Go version: 1.10.3
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
What did you do?
I need to cancel receiving of request body in http server's handle. I use background go routine which blocks on context's channel and closes request body once the channel is closed: request.Body.Close() (go/src/net/http/server.go:878 +0x40)
What did you expect to see?
Receiving of the request stops, no race.
What did you see instead?
The text was updated successfully, but these errors were encountered: