From cd65d77d05f71ca51d81d247312d0d465fdb76c8 Mon Sep 17 00:00:00 2001 From: Travis Bischel Date: Tue, 6 Feb 2024 17:41:33 -0700 Subject: [PATCH] kgo: fix bug Previously, if CommitOffsetsSync was called during a rebalance, and the context being used is canceled while the rebalance was occurring, then the client would deadlock. Internally, committing is blocked if a rebalance is actively happening. There's some complex logic to have, effectively, a cancelable lock if the user wants to not wait for a rebalance to complete while trying to commit offsets. There was a bug, and since the fix is one line, it's easier to see than explain. Closes #668. --- pkg/kgo/consumer_group.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/kgo/consumer_group.go b/pkg/kgo/consumer_group.go index e71fcb52b..81832a6ed 100644 --- a/pkg/kgo/consumer_group.go +++ b/pkg/kgo/consumer_group.go @@ -2584,6 +2584,7 @@ func (g *groupConsumer) commitOffsetsSync( if err := g.waitJoinSyncMu(ctx); err != nil { onDone(g.cl, kmsg.NewPtrOffsetCommitRequest(), kmsg.NewPtrOffsetCommitResponse(), err) + close(done) return } unblockCommits := func(cl *Client, req *kmsg.OffsetCommitRequest, resp *kmsg.OffsetCommitResponse, err error) {