From aab2eda7dfd9f490c36e2e3a9d16ca12f5cebb44 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Wed, 5 Apr 2017 16:03:03 -0700 Subject: [PATCH] clientv3: register waitCancelSubstreams closingc goroutine with waitgroup Fixes #7598 --- clientv3/watch.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clientv3/watch.go b/clientv3/watch.go index 5e00e163f..7847b03b3 100644 --- a/clientv3/watch.go +++ b/clientv3/watch.go @@ -711,7 +711,11 @@ func (w *watchGrpcStream) waitCancelSubstreams(stopc <-chan struct{}) <-chan str ws.closing = true close(ws.outc) ws.outc = nil - go func() { w.closingc <- ws }() + w.wg.Add(1) + go func() { + defer w.wg.Done() + w.closingc <- ws + }() case <-stopc: } }(w.resuming[i])