From 9ef22118a4b25863aa94546daffbc0a18feaafb3 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 9 Nov 2016 21:27:32 +0000 Subject: [PATCH] http2: fix CloseNotify data race Fixes golang/go#17868 Change-Id: I7f9d85f404198d68757d7ca5bb8b1e7aafaafa8b Reviewed-on: https://go-review.googlesource.com/33013 Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot Reviewed-by: Tom Bergan Reviewed-by: Brad Fitzpatrick --- http2/server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/http2/server.go b/http2/server.go index 79f4edfa1..ca77d71d1 100644 --- a/http2/server.go +++ b/http2/server.go @@ -2276,8 +2276,9 @@ func (w *responseWriter) CloseNotify() <-chan bool { if ch == nil { ch = make(chan bool, 1) rws.closeNotifierCh = ch + cw := rws.stream.cw go func() { - rws.stream.cw.Wait() // wait for close + cw.Wait() // wait for close ch <- true }() }