]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.13] net/http: update bundled http2 for memory leak fix
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 4 Oct 2019 04:16:35 +0000 (04:16 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 4 Oct 2019 13:51:14 +0000 (13:51 +0000)
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>
src/net/http/h2_bundle.go

index 53cc5bd1b8cd45047de5cb1fcdcc68e66ce14ba0..e9a55f388a05745bff972d48061bf258cc0fe717 100644 (file)
@@ -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
                }
        }