Skip to content

Fix WriteSet use-after-recycle in sequence reads#4788

Open
void-ptr974 wants to merge 1 commit intoapache:masterfrom
void-ptr974:fix_4680_writeset_use_after_recycle
Open

Fix WriteSet use-after-recycle in sequence reads#4788
void-ptr974 wants to merge 1 commit intoapache:masterfrom
void-ptr974:fix_4680_writeset_use_after_recycle

Conversation

@void-ptr974
Copy link
Copy Markdown
Contributor

Fixes #4680.

Sequence read completion recycled WriteSet before SequenceReadRequest finished using it to register slow bookies. In speculative read scenarios, a faster replica can complete the entry
while an earlier replica is still outstanding, and the completion path could access the recycled WriteSet.

Late error callbacks could also enter retry/error handling after the entry had already completed, which may access recycled writeSet / orderedEnsemble.

Changes

  • Snapshot slow bookie addresses before calling the shared complete() path that recycles WriteSet.
  • Ignore late error callbacks after sequence read requests have already completed.
  • Apply the same lifecycle fix to ReadLastConfirmedAndEntryOp sequence reads.
  • Add regression tests for:
    • normal sequence read completion after speculative retry
    • normal sequence read late error after completion
    • ReadLAC sequence read completion after speculative retry
    • ReadLAC late error after completion

Tests

mvn -pl bookkeeper-server -Dtest=TestSequenceReadWriteSetRecycle test

  Sequence read completion recycled the WriteSet before registering slow bookies.
  When a speculative read completed the entry, the subclass could still access the
  recycled WriteSet. Late error callbacks could also enter reattempt logic and call
  indexOf() after the request had already completed.

  Snapshot slow bookie addresses before delegating to the shared complete path, and
  ignore late errors after sequence read requests have completed. Apply the same
  guard to ReadLAC sequence reads, where orderedEnsemble is also recycled on
  completion.

  Add regression coverage for normal sequence reads and ReadLAC covering both
  completion and late-error paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invoke WriteSet#get() after recycled

1 participant