-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: client errors on server graceful shutdown #23829
Comments
That is not what graceful shutdown means. Graceful shutdown means the server stops accepting new connections and closes idle keep-alive connections while not interrupting a response that's already in flight. If anything, there might be a bug report (for an opt-in feature request) here about the retry policy for the HTTP Transport on non-idempotent requests in the presence of mid-air collisions of client writing (bytes in flight) while server is shutting down an idle connection. HTTP/2 handles that better than HTTP/1, and we don't do any auto-retries for you in HTTP/1. In any case, I'm going to close this bug. Feel free to open a new one about retries if that's what you want, but search for duplicates first (searching for stuff like "Transport" and "Client" and "idempotent" and "POST" and "retry"/"retries"). |
I see a few things here:
Here is a Gist I put together that incorporates all these changes and does not produce an EOF. |
Thanks for the remarks. This happens only with keep-alive connections, so simply adding |
What I tried to show here is not the client issue, but server. Let me give you another example with
This causes the same errors. Is it expected behavior as well? As far as I see it happens because of race condition when checking connection state https://github.com/golang/go/blob/master/src/net/http/server.go#L2607 |
any update? |
It shouldn't be closed |
What version of Go are you using (
go version
)?go version go1.10rc2 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?What did you do?
run server:
go run main.go -cmd server
and client:
go run main.go -cmd client
What did you expect to see?
client gets only
connection refused
errors:What did you see instead?
mix of
connection refused
,EOF
andconnection reset by peer
errors:Server suppose to shutdown gracefully without causing
EOF
orconnection reset by peer
errors on client sideThe text was updated successfully, but these errors were encountered: