Closed
Description
The Transport retry loop checks to see if a request was sent on a fresh connection or a reused one (persistConn.shouldRetryRequest
). Requests sent on a fresh connection are not retried, to avoid looping forever if the server is hanging up on the request for some reason.
Connections are marked as reused when added to the idle conn pool (Transport.tryPutIdleConn
).
HTTP/2 connections are added to the idle conn pool as soon as they're made, since the connection can be reused for additional HTTP/2 requests while the first is in flight.
Thus, we incorrectly retry requests to an HTTP/2 server that hangs up without giving a response (say, because we sent a malformed request), because HTTP/2 connections are always marked as "reused".