Don't fail GroupCoordinator._on_join_prepare() if commit_offset() throws exception #230
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As it currently stands, a Consumer whose membership in a group expires (whether due to message processing that exceeds the
session_timeout_ms
or a brief network interruption) enters an unrecoverable state. Every cycle of the heartbeat routine callsensure_active_group()
, which attempts to commit outstanding offsets before taking any further action. If membership has expired, however, interacting with the coordinator will throw anUnknownMemberIdError
exception and the process will begin again on the next heartbeat cycle.To illustrate, start a Kafka broker with group.min.session.timeout.ms set to a very low value. Populate some data into the
test
topic and then run the following code (#229 is required to set the session timeout properly):The result:
This patch fixes the issue by ignoring exceptions from
_maybe_auto_commit_offsets_sync()
in_on_join_prepare()