Repository navigation
π fix(async): back off contended strict soft lock retries - #928
Merged
Merged
Conversation
gaborbernat
force-pushed
the
fix/async-poll-delay
branch
from
November 16, 2026 21:10
c46437c to
a274238
Compare
gaborbernat
force-pushed
the
fix/async-poll-delay
branch
from
November 16, 2026 22:04
a274238 to
8d827d2
Compare
Replace the spy on the private _poll_delay hook with a test that checks the delays a contended AsyncStrictSoftFileLock sleeps, which fails when the backoff is dropped. Reword the changelog entry around that user visible change: only a poll_interval below the 0.05 s cap jitters.
The polling how-to said every lock retries at regular intervals, which no longer holds for strict locks in either form. Say when they widen their wait and why. Move the async backoff test next to the other strict lock tests, whose module already requires hard links, so it needs no marker or coverage pragma of its own.
A one second timeout clamps the last delay on a slow Windows runner, so the test now waits up to 30 seconds; cancel_check still stops it after five draws. Also define the attempt counter next to its loop and word the how-to backoff bound precisely.
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.
Processes contending for an
AsyncStrictSoftFileLockretried on a fixed cadence, while the same contention on aStrictSoftFileLockwaits a random delay betweenpoll_intervaland a window that starts at twicepoll_intervaland doubles each attempt, up to a fixed 0.05 second cap. With apoll_intervalbelow that cap, async waiters kept retrying in step, each one publishing and rescanning its claim files at the same moment as the others. Async and sync strict locks now back off the same way under contention; locks left on the defaultpoll_intervalsee no change.The async wait loop now takes each retry's delay from the lock's backoff policy, as the sync loop already did, counting failed attempts from the start of each acquire. Only the strict soft locks define a backoff, so every other lock type gets its
poll_intervalback unchanged, and each delay is still clamped to the remainingtimeout.The polling how-to now says that strict locks, sync or async, widen their wait under contention instead of retrying at a fixed interval.