Skip to content

KAFKA-17734: Reset group state before polling in maybeLeaveGroup - #23512

Open
dybyte wants to merge 1 commit into
apache:trunkfrom
dybyte:KAFKA-17734
Open

dybyte wants to merge 1 commit into
apache:trunkfrom
dybyte:KAFKA-17734

Conversation

@dybyte

@dybyte dybyte commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

maybeLeaveGroup() polls the network client right after sending
LeaveGroup, while the member state is still PREPARING_REBALANCE. If a
JoinGroup response of an in-flight rebalance is pending, that poll
processes it; when this member is elected leader, onLeaderElected()
waits for a metadata refresh with an unbounded timer. With brokers
unreachable, close() never returns regardless of its timeout, and
wakeup() cannot interrupt it since close() disables wakeups.

Reset the state to UNJOINED before polling, so the JoinGroup handler
discards the response instead of driving a rebalance for a member that
is leaving.

Added a test that delivers a leader-electing JoinGroup response during
the LeaveGroup poll with brokers backed off. It hangs on trunk and
passes with this change.

Co-Authored-By: Claude

@github-actions github-actions Bot added triage PRs from the community consumer clients small Small PRs labels Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clients consumer small Small PRs triage PRs from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant