aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2019-10-04 04:16:35 +0000
committerBrad Fitzpatrick <bradfitz@golang.org>2019-10-04 13:51:14 +0000
commitfa325ea2a584870297485b7ada7ee3d3b7fc7e2a (patch)
treec3ffe2042d7989cb38c74d925c735220e9765f15
parent84b070f6fab474f9e278d9e85b198e1382499b48 (diff)
downloadgo-fa325ea2a584870297485b7ada7ee3d3b7fc7e2a.tar.gz
go-fa325ea2a584870297485b7ada7ee3d3b7fc7e2a.zip
[release-branch.go1.13] net/http: update bundled http2 for memory leak fix
This re-runs go generate with x/net checked out at CL 198617 on the release-branch.go1.13 branch for: [release-branch.go1.13] http2: fix memory leak in random write scheduler Fixes golang/go#34636 Updates golang/go#33812 Change-Id: Ibce630c6c7ffe43ff760d2ad40b44731c07ba870 Reviewed-on: https://go-review.googlesource.com/c/go/+/198897 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
-rw-r--r--src/net/http/h2_bundle.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go
index 53cc5bd1b8..e9a55f388a 100644
--- a/src/net/http/h2_bundle.go
+++ b/src/net/http/h2_bundle.go
@@ -10148,7 +10148,8 @@ type http2randomWriteScheduler struct {
zero http2writeQueue
// sq contains the stream-specific queues, keyed by stream ID.
- // When a stream is idle or closed, it's deleted from the map.
+ // When a stream is idle, closed, or emptied, it's deleted
+ // from the map.
sq map[uint32]*http2writeQueue
// pool of empty queues for reuse.
@@ -10192,8 +10193,12 @@ func (ws *http2randomWriteScheduler) Pop() (http2FrameWriteRequest, bool) {
return ws.zero.shift(), true
}
// Iterate over all non-idle streams until finding one that can be consumed.
- for _, q := range ws.sq {
+ for streamID, q := range ws.sq {
if wr, ok := q.consume(math.MaxInt32); ok {
+ if q.empty() {
+ delete(ws.sq, streamID)
+ ws.queuePool.put(q)
+ }
return wr, true
}
}