Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.11.3 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env
What did you do?
About net/http/transport.getConn
When current conn number is greater than MaxConnPerHost, incHostConnCount
return connPerHostAvailable and caller block on this chan, but connPerHostCount will not inc.
When somebody is block on connPerHostAvailable and one conn be closed, decHostConnCount
notify and connPerHostCount dec.
One Example:
- MaxConnsPerHost is one
Time 1
- ReqA call
getConn
and get connA, connPerHostCount now is one
Time 2
- ReqB call
getConn
but block on connPerHostAvailable or idleConnCh
Time 3
- ReqA close connA, notify ReqB and dec connPerHostCount
- ReqB notify by idleConnCh and create connB
Time 4
- ReqC call
getConn
and create connC
current two conns exist, but MaxConnsPerHost is one.
What did you expect to see?
When somebody is block on connPerHostAvailable and one conn be closed, decHostConnCount
notify and connPerHostCount don't dec.