Skip to content

net/http: HTTP/2 retry loop broken when net/http manages dials #52459

Open
@neild

Description

@neild

http2.Transport.RoundTripOpt retries requests under some circumstances (transport.go#492):

for retry := 0; ; retry++ {
  cc, err := t.connPool().GetClientConn(req, addr)
   if err != nil {
    t.vlogf("http2: Transport failed to get client conn for %s: %v", addr, err)
    return nil, err
  }
  // ...

When using the bundled HTTP/2 support in net/http, however, GetClientConn does not dial connections when none are available. Instead, it returns ErrNoCachedConn and net/http handles the dial.

This results in an infinite retry loop when the server immediately hangs up on a retryable request.

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions