Skip to content

Commit

Permalink
kgo: fix bug
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
twmb committed Feb 7, 2024
1 parent d40ac19 commit cd65d77
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/kgo/consumer_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit cd65d77

Please sign in to comment.