Skip to content

Anchor lock-expiration validation to the first claim - #76

Open
Thom Chiovoloni (thomcc-work) wants to merge 1 commit into
mainfrom
thomcc/claim-timed-lock-recovery
Open

Thom Chiovoloni (thomcc-work) wants to merge 1 commit into
mainfrom
thomcc/claim-timed-lock-recovery

Conversation

@thomcc-work

@thomcc-work Thom Chiovoloni (thomcc-work) commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix a timing assumption in the multi-threaded lock-expiration provider
validation. Previously, the recovery wait started at a task-start barrier,
before the first fetch had acquired its lease. A slow connection acquisition
could consume the 100 ms expiry margin, causing the recovery fetch to run
while the lease was still valid.

This change:

  • Measures both the “still locked” check and the recovery wait from the first
    completed claim.
  • Checks that recovery returns a different token from the original claim.
  • Adds a gated-fetch regression that delays the initial claim beyond the
    lease duration plus recovery margin.

The requested lease duration and existing timing margins remain unchanged.
There are no production provider or runtime behavior changes.

Checklist

  • Tests added/updated
  • Regular tests pass locally (cargo nt)
  • Doc tests pass locally (cargo test --doc --all-features)
  • Docs updated
    • Existing docs updated where behavior changed
    • New doc added under docs/ if introducing a new area
    • Linked from docs/README.md

Discovered while reviewing microsoft/duroxide-pg#41.

Measure the concurrent checks from the first completed claim rather than
the startup barrier. Connection acquisition could otherwise consume the
expiry margin and make a correct provider fail validation.

Add a delayed-fetch regression and compare the recovered token with the
original claim's token. Lease durations and timing margins are unchanged.
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.

1 participant