Skip to content

net/http: method decHostConnCount should not dec counter when somebody is block on connPerHostAvailable #29889

Closed
@j2gg0s

Description

@j2gg0s

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions