Repository navigation
[fix][broker] Fix assignment and ownership cleanup races in the extensible load manager - #26520
Merged
Merged
Conversation
Assisted-by: Codex (GPT-6)
lhotari
requested review from
Technoboy-,
dao-jun,
david-streamlio,
merlimat and
nodece
September 10, 2026 12:32
lhotari
marked this pull request as draft
September 10, 2026 12:39
…ger shutdown Assisted-by: Codex (GPT-6)
lhotari
marked this pull request as ready for review
September 10, 2026 12:59
heesung-sohn
approved these changes
Sep 10, 2026
1 of 11 tasks
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.
Motivation
The extensible load manager can lose ownership cleanup updates to concurrent assignments, and can accept late assignments after shutdown cleanup has started. This CI job exposed these races through background topic-policy initialization assigning the
__change_eventsbundle:Assigning(version 1)and publishes an override at version 2. If the assignment'sOwned(version 2)update wins, the conflict resolver rejects the cleanup override. Cleanup previously only waited, leaving the bundle owned by the broker being cleaned up and consuming its five-second wait.The cleanup retry and polling changes apply both to graceful shutdown and to the leader's cleanup of inactive brokers during failure recovery. Topic policies exposed the races, but other concurrent bundle lookups can trigger them as well. The changes are confined to the extensible load manager.
The reported test initially exceeded its five-second shutdown assertion, then its retry failed with HTTP 409 because it reused the same topic name.
Modifications
Verifying this change
Both regression tests were checked against the previous production code and failed:
testCleanupRetriesConcurrentAssignment: the bundle remainedOwnedafter the same-version cleanup override was rejected.testCleanupDrainsAssignmentsAndRejectsNewOnes: the disabled channel accepted a late assignment.With the fix and
-PtestRetryCount=0 -PtestFailFast=false:ServiceUnitStateChannelTest: 66 tests passed across system-topic and metadata-store ownership tables.ExtensibleLoadManagerCloseTest: 40 invocations passed, covering both topic-policy settings and both shutdown scenarios. The temporary tenfold repetition ontestLookupwas removed afterward; the pre-existing repetition ontestCloseAfterLoadingBundlesremains../gradlew quickCheckpassed.Does this pull request potentially affect one of the following parts:
Normal bundle assignments now track their publication and briefly acquire the same lock used by channel disable. Shutdown waits for already-accepted assignment writes before ownership cleanup; no storage operation or future completion runs under that lock.