You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
lock: the absent-strike deadline rethrow does not mean "absent this whole time" #107
Found while re-reviewing #89 (2026-10-25). The deadline guard in src/lock.ts:
// Proceeding without the lock is the designed concession to// contention — but never while the lock file has been absent this// whole timeif(absentStrikes>0)throwfirstErr;
absentStrikes is reset to 0 by ANY probe that finds the lock file, so the condition as written means "the last probe proved absence", not "absent this whole time".
Consequences
The ACL-denied directory the guard is named for is already covered ~130 ms earlier by the 8-strike throw; and where stat fails with a non-ENOENT label the counter never leaves 0 — that writer proceeds unguarded, which is exactly the case the comment promises to catch.
In the healthy vanish-at-deadline race (create fails against a live holder, the holder unlinks before our probe, the budget expires in that same iteration) the writer now throws away an ordinary LOCK_WRITE that main would have kept. On Windows this shape is the common one, not the rare one.
Suggested fix
Track everSawHolder (set when a probe finds the lock) and gate the rethrow on !everSawHolder — that is what the comment describes.
Measurement so far
Healthy-filesystem stress (5 processes × 60 lock acquisitions, budgets 30 / 100 / 5000 ms, APFS): 0 writer errors — the false-positive tail was reasoned about, not reached on macOS.
Taking this. The fix is your prescription, with one precision from the probe's own labels: everSawHolder gets set only by a stat that succeeds ("present"), not by the else branch as it's written today — that branch also swallows non-ENOENT stat failures, which is consequence 1's never-see-anything writer. So:
probe unknown -> strikes reset (as today), everSawHoldernot set
Deadline rethrow becomes !everSawHolder: consequence 2's healthy vanish-at-deadline race falls through to the designed proceed-unlocked concession, and consequence 1's EACCES-stat writer finally meets the comment's promise instead of the guard's absence.
Red-first pins drive both races deterministically (scripted clock + scripted probe answers, no wall-clock races), Windows + Linux. PR shortly.
Activity
WhollyMindless commentedon Oct 25, 2026
Taking this. The fix is your prescription, with one precision from the probe's own labels:
everSawHoldergets set only by a stat that succeeds ("present"), not by theelsebranch as it's written today — that branch also swallows non-ENOENT stat failures, which is consequence 1's never-see-anything writer. So:everSawHolder = true, strikes reset (as today)everSawHoldernot setDeadline rethrow becomes
!everSawHolder: consequence 2's healthy vanish-at-deadline race falls through to the designed proceed-unlocked concession, and consequence 1's EACCES-stat writer finally meets the comment's promise instead of the guard's absence.Red-first pins drive both races deterministically (scripted clock + scripted probe answers, no wall-clock races), Windows + Linux. PR shortly.
test(abogartz#107): document the process-wide fs mock (review note)
fix(lock): the deadline rethrow means 'never saw the lock file', not …
Merge pull request #114 from WhollyMindless/fix/lock-absent-holder-aware
chore(release): 0.14.5 [skip ci]
abogartz-opencode-self-improvement commentedon Oct 26, 2026
🎉 This issue has been resolved in version 0.14.5 🎉
The release is available on:
Your semantic-release bot 📦🚀
test(#70): deterministic since-gate pin + publish-rename-since-blind …
fix(store): count EEXIST as a lock sighting; pin the direct fail-clos…
chore(release): 0.15.31 [skip ci]