From 5f9ae10d9af5b1c89ae6904293b14b064d4ada23 Mon Sep 17 00:00:00 2001 From: Mark Fischer Date: Fri, 20 Apr 2018 03:04:21 -0400 Subject: [PATCH] http2: terminate await request cancel goroutine on conn close If conn closes but the request cancel select is still blocked we must close the connection wait channel. Updates golang/go#24776 (needs bundle into std for fix) Change-Id: I7e3ffdf2dd9b127727e24fe262b2f4c5d96fc184 Reviewed-on: https://go-review.googlesource.com/108415 Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- http2/transport.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/http2/transport.go b/http2/transport.go index e6b321f4b..da91d19dd 100644 --- a/http2/transport.go +++ b/http2/transport.go @@ -951,6 +951,9 @@ func (cc *ClientConn) awaitOpenSlotForRequest(req *http.Request) error { for { cc.lastActive = time.Now() if cc.closed || !cc.canTakeNewRequestLocked() { + if waitingForConn != nil { + close(waitingForConn) + } return errClientConnUnusable } if int64(len(cc.streams))+1 <= int64(cc.maxConcurrentStreams) {