From d9c846843415231b13e28f0ec3a2530abf9b7918 Mon Sep 17 00:00:00 2001 From: Travis Bischel Date: Sun, 14 Jan 2024 13:49:00 -0700 Subject: [PATCH] kfake: do not return early when running control functions if the cluster is closed If we return while running a control function (which is expected to be fast), we may unlock a mutex that is currently unlocked and only relocked after the control function exits. Notably, tryControl was panicking because a cluster was closed while a control function was running. --- pkg/kfake/cluster.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkg/kfake/cluster.go b/pkg/kfake/cluster.go index fb622f41..e1a92969 100644 --- a/pkg/kfake/cluster.go +++ b/pkg/kfake/cluster.go @@ -310,8 +310,6 @@ outer: inner: for { select { - case <-c.die: - return case admin := <-c.adminCh: admin() continue inner @@ -604,8 +602,6 @@ func (c *Cluster) tryControlKey(key int16, creq *clientReq) (kmsg.Response, erro res := c.runControl(cctx, creq) for { select { - case <-c.die: - return nil, nil, false case admin := <-c.adminCh: admin() continue