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 · 1 comment


Copy link

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

This comment has been minimized.

Copy link

commented Jul 30, 2019

I remember @rsc looked into something similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.