Skip to content

Close the legacy lock-directory takeover race - #41

Merged
webos21 merged 1 commit into
mainfrom
fix/lock-legacy-takeover-race
Nov 22, 2026
Merged

webos21 merged 1 commit into
mainfrom
fix/lock-legacy-takeover-race

Conversation

@webos21

@webos21 webos21 commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Follow-up from review of Replace the store directory lock with an OS file lock #40: stale legacy lock directories were removed with remove_all, which could also delete a lock file created at the same path by another process in the meantime, letting two processes hold the lock.
  • Takeover now removes only the legacy owner file and calls rmdir (refuses a regular file). Other directory contents are left alone and the caller keeps waiting until the deadline.
  • TODO records two open limits: no in-process exclusion in Lock, and lock files are never removed.

Verification and limits

  • Windows x64: store-lock-test (9 checks) and sdk-store-test (113 checks) pass.
  • The race has no deterministic test; it is closed by construction. Linux/macOS/arm64 are covered only by this PR's CI.

🤖 Generated with Claude Code

Taking over a stale legacy lock directory used remove_all, which could
delete a lock file another process had created at the same path in the
meantime and let two processes hold the lock. Remove only the legacy
owner file and then rmdir, which refuses a regular file; leave any other
contents alone and keep waiting. Record the in-process exclusion and
lock-file accumulation limits in TODO.

Verified on Windows x64: store-lock-test and sdk-store-test pass.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@webos21
webos21 merged commit 44fbf24 into main Nov 22, 2026
8 checks passed
@webos21
webos21 deleted the fix/lock-legacy-takeover-race branch November 22, 2026 09:46
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