fix: release record supplier lock on validation failure - #19811
Open
FrankChen021 wants to merge 1 commit into
Open
fix: release record supplier lock on validation failure#19811FrankChen021 wants to merge 1 commit into
FrankChen021 wants to merge 1 commit into
Conversation
FrankChen021
marked this pull request as ready for review
July 30, 2026 22:26
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a lock-leak bug in SeekableStreamSupervisor#checkOffsetAvailability where recordSupplierLock could remain held if record-supplier assignment validation failed, potentially blocking later supervisor operations.
Changes:
- Moved record-supplier assignment validation inside the existing
try/finallyto guaranteerecordSupplierLock.unlock()on all post-lock-acquisition paths. - Added a targeted regression test that triggers the assignment-mismatch exception path and asserts the lock is released afterward.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java |
Ensures recordSupplierLock is always released even when assignment validation throws. |
indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisorStateTest.java |
Adds a regression test covering the assignment-mismatch exception and lock-release behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
FrankChen021
commented
Jul 31, 2026
FrankChen021
left a comment
Member
Author
There was a problem hiding this comment.
I have reviewed the code for correctness, edge cases, concurrency, and integration risks; no issues found.
Reviewed 2 of 2 changed files.
This is an automated review by Codex GPT-5.6-Sol
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.
Root cause
checkOffsetAvailabilityacquiredrecordSupplierLock, then validated the record supplier assignment before entering thetry/finallythat releases the lock. If the assignment did not contain the expected stream partition, the validation threwIllegalStateExceptionand permanently retained the reentrant lock on that thread.Fix
Move the assignment validation into the existing
tryblock so every path after successful lock acquisition reaches thefinallyand unlocks.Add a focused regression test that exercises the assignment-mismatch exception and verifies that
recordSupplierLockis no longer locked afterward.Impact
This prevents a malformed or unexpectedly changed record-supplier assignment from leaking the supervisor's supplier lock and potentially blocking later record-supplier operations. Successful offset-availability checks and lock scope are unchanged.
Validation
mvn -ntp -Pskip-static-checks -pl indexing-service -Dtest=SeekableStreamSupervisorStateTest testmvn -ntp -pl indexing-service -DskipTests checkstyle:checkgit diff --check