fix: exit cleanly on Kafka commit ILLEGAL_GENERATION#70
Merged
Conversation
When the consumer's generation ID is stale (ILLEGAL_GENERATION) or it's no longer a member (UNKNOWN_MEMBER_ID), the commit is rejected because the partitions have been reassigned. Continuing to process just causes duplicate writes against the new owner. Close the consumer and raise so the runner exits and k8s restarts with a fresh consumer that rejoins the group cleanly. Other commit errors keep log-and-continue. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
ILLEGAL_GENERATIONorUNKNOWN_MEMBER_ID, the consumer has been evicted from the group and its partitions are now owned by someone elsecommit()logged and returned), so the evicted consumer kept processing messages and duplicating writes against the new partition owner until the next rebalanceContext
Seen repeatedly in production under v0.3.10:
Test plan
uv run pytest tests/connectors/sources/kafka/— all 27 tests passuv run ruff check && ruff format --check🤖 Generated with Claude Code