Repository navigation
🐛 fix(soft-rw): renew waiters and bound cleanup - #1097
Merged
Merged
Conversation
A delayed sweep could remove a waiter's record after it resumed and gained the lock. With no recorded lease, a peer with a shorter threshold could enter alongside the holder. Retire a token when its record or commit spans the stale threshold, so a late unlink reaches only the old record name. Fixes tox-dev#1010
Another host can mark a waiter's token stale during host suspension while the waiter sees less than one lease on CLOCK_MONOTONIC. A delayed sweep can then unlink a newly granted holder's record. Count suspended time for the local token's lease age on systems with CLOCK_BOOTTIME. Peer observations keep their monotonic clock, since a host cannot assume that a filesystem read stayed current while it slept. Fixes tox-dev#1052
gaborbernat
force-pushed
the
review/soft-rw-protocol-e
branch
from
November 20, 2026 15:35
da53c10 to
09ae8ea
Compare
gaborbernat
marked this pull request as ready for review
November 20, 2026 17:43
gaborbernat
marked this pull request as draft
November 20, 2026 17:52
gaborbernat
marked this pull request as ready for review
November 20, 2026 17:55
gaborbernat
marked this pull request as draft
November 20, 2026 19:45
A user able to populate a non-sticky shared lock tree could make one acquire sweep read every planted holder and commit record before the caller's deadline was checked. Limit orphan cleanup and generation pruning per pass. Reject a partial generation listing because it may omit the current head; later passes can clean the remaining orphan records. Refs tox-dev#995
gaborbernat
force-pushed
the
review/soft-rw-protocol-e
branch
from
November 20, 2026 19:46
09ae8ea to
4b463f8
Compare
gaborbernat
marked this pull request as ready for review
November 20, 2026 21:36
gaborbernat
marked this pull request as draft
November 20, 2026 21:59
gaborbernat
marked this pull request as ready for review
November 20, 2026 22:00
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.
A
SoftReadWriteLockwaiter that resumes after its lease expires now withdraws its old token before requesting a new one. A delayed cleanup can then remove the old record while the new hold remains valid. The waiter counts time spent asleep on macOS and systems withCLOCK_BOOTTIME. Elsewhere it uses the host's monotonic clock. Fixes #1010 and fixes #1052.Each sweep lists up to 65,537 names per directory and sorts the candidates. It reads up to 256 orphan holder records and 256 temporary commit files, continuing from its last position. To track changes between sweeps, the lock keeps one fixed-size digest per observed name. Fixes #995 and fixes #997.
A generation directory with more than 65,536 entries raises a protocol error. If the directory crosses the limit after a writer publishes a generation, the writer declines the commit and leaves the record in place because a peer may already have extended it.