net/http: Transport doesn't discard connections which received a 408 Request Timeout #39063
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Uh oh!
There was an error while loading. Please reload this page.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I'm reading net/http for implementing HTTP client in Go. I want to use connections pool functionality of it but not sure how to deal with the stale connections.
*http.Transport
says it retries the request if a connection got closed by serverwhile it was trying to read the response
.go/src/net/http/transport.go
Lines 640 to 645 in a88c26e
Since #32310, the connection is discarded also when
408 Request Timeout
is sent on it.go/src/net/http/transport.go
Lines 2127 to 2135 in a88c26e
But if a connection receives
408
as a response to the request, no retry is held and that connection doesn't get discarded. So the client of*http.Transport
sees408
response repeatedly until that connection actually gets closed from the server.Two open questions:
*http.Transport
)'s responsibility to retry the request when it sees408
?*http.Transport
doesn't discard connections which got408
?You can reproduce this situation with the server which responses
408
for requests but doesn't close the connection immediately:Then the client always sees
408
through the cached connection.What did you expect to see?
When
*http.Transport
get 408 as a response, it should discard the connection and retry with another.What did you see instead?
When
*http.Transport
get 408 as a response, it doesn't discard the connection nor retry.The text was updated successfully, but these errors were encountered: