net/http: setting IdleConnTimeout to a low value on http.Transport is causing non-deterministic tls handshake failures #33891
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
)?What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Consider the following program that sets
IdleConnTimeout: 1 * time.Nanosecond
MaxIdleConns: 1
and makes GET https://example.com calls:
What did you expect to see?
Client uses tls connection fully. Puts it back, then the timeout starts counting.
What did you see instead?
It seems like there’s a race between this deadline and how the connection is used. After 1 nanosecond the connection expires and goes away from the pool, so I get non-deterministic tls handshake failures
Sometimes 1 or 2 requests work before tls handshake error hits. Sometimes it directly fails on the first request:
Apparently the conn is actually being used for tls handshake, possibly because 1 nanosecond is too low so that when the connection is established, it goes away just before TLS handshake starts.
Not sure if this is expected.
The text was updated successfully, but these errors were encountered: