-
Notifications
You must be signed in to change notification settings - Fork 17.5k
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: EnableFullDuplex without closing Request.Body panics with invalid concurrent Body.Read call #68560
Comments
invalid concurrent Body.Read call
panic when EnableFullDuplex
is enabled in http.Server.Handler
Any request with a body will do, e.g. Looks like the concurrent read happens when the server tries to drain the body in preparation for reusing the connection. Adding either of the below avoids the panic:
|
cc @neild |
That makes sense. I can confirm that the other clients I tried were adding |
@seankhliao When the server has |
Go version
go version go1.22.5 linux/amd64
Output of
go env
in your module/workspace:What did you do?
While I encountered this with a full fledged server I simplified it down to this script:
I then narrowed down the issue to when I make a request like so:
I don't have this problem when I try to reproduce the issue in Postman or craft the request myself, even when I make it obstensibly identical. Likely because of differences in client behaviours.
What did you see happen?
The program panicked with this result:
What did you expect to see?
I expected no panic. Perhaps there's a reason that enabling
EnableFullDuplex
is bad in a handler like this but I couldn't find any documentation that suggested this would be harmful.I could manage to get this panic to go away by moving this handler a bit later into the actual router I have but this seems to indicate to me that it's actually a race condition or something.
The text was updated successfully, but these errors were encountered: