-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
group: fix blocking commit on leave; potential deadlock
As it turns out, we were already performing a blocking commit on leave with the defaultRevoke, but we had a bug that made it never issue: committing always died if the group's context was canceled, which is the first thing we did when leaving the group so that we could break out of the heartbeat loop. We take a multi pronged fix to this. First, we now do not kill commits if the group context is closed. This is a bit odd, but the group context is only closed to break out of the manage loop, it does not mean that the member has been booted. Second, we specifically opt in to the revoke function if the group-manage loop quits with context.Canceled _and_ if the group is cooperative. There is a big comment detailing why. Third, we now no longer default onLost to the onRevoked. It's not right to call revoke on fatal errors, because fatal errors mean it is no longer possible to commit. Fourth, we cannot go through the client's BlockingCommitOffsets function when leaving a group and using the default revoke, because the first thing that happens when leaving a group is to unset the group consumer, so the client level BlockingCommitOffsets will not be able to commit. We now have a dedicated blockingCommitOffsets method on the group consumer; this is used for default revokes. We also explicitly document that if a user has disabled autocommitting, they must manually commit before leaving the group. Fifth, if a commit contained no offsets to commit, then we could deadlock, because all calls to `commit` assumed that it was non-blocking, when a no-offset commit would immediately call onDone. We now call that in a goroutine. --- Because of the above, we actually do not need DisableBlockingCommitOnLeave, because that actually is our default behavior already with autocommitting enabled. --- As a few other small included updates, we - have a small patch of the prior commit - update docs that mentioned the now removed option - now use commitCallback in defaultRevoke
- Loading branch information
Showing
5 changed files
with
90 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters