Skip to content

x/net/http2: regression in Transport's reuse of connections #60818

Closed
@bradfitz

Description

The fix to #59690 (https://go-review.googlesource.com/c/net/+/486156) broke our load balancer.

That change made any RoundTripper caller's cancelation ends up tainting the underlying HTTP/2 connection (setting its do-not-reuse bit), causing our load balancer to create new conns forever, rather than reuse existing totally fine ones.

Of note: our application only uses ClientConn.RoundTrip (not Transport.RoundTrip), so moving up the connection tainting up a level (to where it arguably belongs in Transport & its conn pool) would fix us, but still isn't the proper fix for others.

The original issue was about dead backend connections and Transport reusing them forever. It fixed it, but a bit too aggressively. We shouldn't mark good connections (in-use, recent traffic, able to reply to pings, etc) as do-not-reuse. This is already addressed if you enable pings on your backend connections, but that's not the default, probably because it's not network chatty to do by default for idle connections.

@neild and I discussed a handful of options but I'm not we've decided on any particular path(s). Some:

  • move the tainting up a level (again, fixes us, but not everybody). but maybe do this first anyway, because it's not ClientConn's job to blindly mark itself as broken if the caller cancels its context after a nanosecond.
  • do PING frames to the backend even when the periodic pinger is not enabled under certain circumstances: like when the health of the ClientConn is in question. (on errors, on a new request after N seconds have elapsed since last hearing from the backend?) but have at most one ping outstanding at a time per ClientConn.

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions