From f6a203fe2383f9de1671b63182b5f7d22b086fab Mon Sep 17 00:00:00 2001 From: Maisem Ali Date: Tue, 5 Sep 2023 12:12:08 -0700 Subject: [PATCH] control/controlclient: check c.closed in waitUnpause We would only check if the client was paused, but not if the client was closed. This meant that a call to Shutdown may block forever/leak goroutines Updates #cleanup Signed-off-by: Maisem Ali --- control/controlclient/auto.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control/controlclient/auto.go b/control/controlclient/auto.go index ed2b3a018..c46feb0df 100644 --- a/control/controlclient/auto.go +++ b/control/controlclient/auto.go @@ -38,7 +38,7 @@ var _ Client = (*Auto)(nil) // closed). func (c *Auto) waitUnpause(routineLogName string) (keepRunning bool) { c.mu.Lock() - if !c.paused { + if !c.paused || c.closed { defer c.mu.Unlock() return !c.closed }