]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.13] net/http: fix wantConnQueue memory leaks in Transport
authorBryan C. Mills <bcmills@google.com>
Mon, 26 Aug 2019 20:44:36 +0000 (16:44 -0400)
committerBryan C. Mills <bcmills@google.com>
Tue, 27 Aug 2019 18:37:25 +0000 (18:37 +0000)
commit44a66acc716f39325f78ff8bc9be4567326591c9
tree4591b506f4a9fa8c3e39a60d7de95e416abd11d0
parent633d0c97652bd110a3bbd84f280d4f19366b8c3e
[release-branch.go1.13] net/http: fix wantConnQueue memory leaks in Transport

I'm trying to keep the code changes minimal for backporting to Go 1.13,
so it is still possible for a handful of entries to leak,
but the leaks are now O(1) instead of O(N) in the steady state.

Longer-term, I think it would be a good idea to coalesce idleMu with
connsPerHostMu and clear entries out of both queues as soon as their
goroutines are done waiting.

Cherry-picked from CL 191964.

Updates #33849
Updates #33850
Fixes #33878

Change-Id: Ia66bc64671eb1014369f2d3a01debfc023b44281
Reviewed-on: https://go-review.googlesource.com/c/go/+/191964
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 94bf9a8d4ad479e5a9dd57b3cb8e682e841d58d4)
Reviewed-on: https://go-review.googlesource.com/c/go/+/191967
src/net/http/transport.go
src/net/http/transport_test.go