GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
GeezerVison is showing github.com — [fix][ml] Release terminal read ownership before notifying callbacks by codelipenghui · Pull Request #27381 · apache/pulsar Conversation
Contributor
MotivationWhen a waiting cursor reaches a terminated ledger's end, its EOF callback currently runs without releasing the waiting-read reservation. A subsequent or reentrant read can therefore fail with ModificationsClaim only the original waiting operation and its identity, remove its waiting registration under the existing registration lock, and recycle it before notifying the observer. Keep the callback outside the lock and isolate observer failures. This is a wait-only operation: it never incremented the pending-read count, so the fix does not decrement that count or alter the existing read/replay accounting. Verifying this changeTests-only execution on unpatched Apache master With the fix, 33 cases passed, with no failures/errors/skips and retries disabled:
./gradlew :managed-ledger:test \ --tests ManagedCursorTerminalReadTest \ --tests ManagedLedgerReadPathSyncFailureTest \ --tests ManagedLedgerTerminationTest \ -PtestRetryCount=0 -PtestMaxParallelForks=1 -PtestJavaVersion=21 ./gradlew quickCheck Does this pull request potentially affect one of the following parts:
Threading: coordinate terminal completion and replacement waiting-read registration using the existing lock; callbacks remain outside it.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsRelease only the exact waiting read and registration before terminal callbacks. Recycle wait-only operations without changing pending-read accounting, and isolate observer failures from duplicate completion. Four tests-only cases fail on unpatched master; all33 scoped cases and quickCheck pass with retries disabled. Assisted-by: OpenAI Codex A delayed check claimed its waiting read with getAndUpdate, comparing the pooled OpReadEntry reference and its id in the update function. The compare-and-set only compares the reference, so if the read was cancelled, recycled and registered again with the same instance between the id check and the CAS, the stale check cleared the replacement's registration and the replacement never got a callback. Register each waiting read with a new WaitingRead token and claim it with a single compareAndSet on that token, in both the terminal and the entries-available paths. A stale check can no longer match a later registration of the same OpReadEntry. Add a regression test that forces the pool to reuse the cancelled read's OpReadEntry for the replacement and runs the stale check against it. Assisted-by: Claude Code (claude-opus-5-5) Co-Authored-By: Claude Opus 5.5 <[email protected]>
codelipenghui
marked this pull request as ready for review
codelipenghui
requested review from
Denovo1998,
lhotari,
merlimat and
poorbarcode
void-ptr974
approved these changes
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Denovo1998
approved these changes
poorbarcode
approved these changes
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NIT — The impact looks limited, but I’d suggest stopping the dispatcher’s automatic read retry once it has notified consumers that a terminated topic has no backlog. To reproduce, terminate an empty non-partitioned topic, then subscribe with an
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsUh oh!
There was an error while loading. Please reload this page.
lhotari
pushed a commit
that referenced
this pull request
…27381) Co-authored-by: Claude Opus 5.5 <[email protected]> (cherry picked from commit 2a4654d)
1 of 10 tasks
poorbarcode
pushed a commit
to poorbarcode/pulsar
that referenced
this pull request
…pache#27381) Co-authored-by: Claude Opus 5.5 <[email protected]> (cherry picked from commit 2a4654d)
poorbarcode
pushed a commit
to poorbarcode/pulsar
that referenced
this pull request
…pache#27381) Co-authored-by: Claude Opus 5.5 <[email protected]> (cherry picked from commit 2a4654d)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reviewers+1 more reviewerUh oh!
There was an error while loading. Please reload this page. AssigneesLabels
cherry-picked/branch-4.0
cherry-picked/branch-4.2
cherry-picked/branch-5.0
release/4.0.15
release/4.2.6
release/5.0.2
type/bug
ProjectsDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. | |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |