Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/net/http2: Strict handling of http.Transport.DisableKeepAlives in http2 #33260

maurice2k opened this issue Jul 24, 2019 · 3 comments

x/net/http2: Strict handling of http.Transport.DisableKeepAlives in http2 #33260

maurice2k opened this issue Jul 24, 2019 · 3 comments


Copy link

@maurice2k maurice2k commented Jul 24, 2019

What version of Go are you using (go version)?

go version go1.12.7 linux/amd64

Does this issue reproduce with the latest release?


What did you do?

Using a http.Transport with http.Client and multiple concurrent outgoing http(s) connections. Basically load testing an http(s) endpoint.

Set http.Transport.DisableKeepAlives to true to enforce a single connection for each request.

What did you expect to see?

I was expecting to see n connections for n requests. This is true for http(s)/1.1 but http2 is re-using connections even though http.Transport.DisableKeepAlives is true.

I understand that this is not strictly a http2 feature but gets translated to http2 in func (t *http2Transport) disableKeepAlives() bool and thus should have the same meaning.

What did you see instead?

Works for http(s)/1.1 but http2 connections get re-used. In a test with n requests and a concurrency of c only ~c connections where used (instead of expected n connections).

How to fix?

See here: golang/net#48

Related issues

  • x/net/http2: connection reused with DisableKeepAlives #22441
  • x/net/http2: Transport ignores net/http.Transport.Proxy once connected #25793
  • net/http: http2 transport doesn't respect all http1 Transport fields #14008
Copy link

@FiloSottile FiloSottile commented Jul 30, 2019

I remember @rsc looked into something similar.

Copy link

@maurice2k maurice2k commented Sep 27, 2019

Can I help with something?

Copy link

@gopherbot gopherbot commented Oct 14, 2019

Change mentions this issue: http2: make Transport.NewClientConn respect Transport.DisableKeepAlives

@golang golang locked and limited conversation to collaborators Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants