Skip to content

fix(lock): a live writer keeps its lock regardless of age (#1959) - #1978

Closed
danusha2345 wants to merge 1 commit into
colbymchenry:mainfrom
danusha2345:fix/1959-lock-pid-only
Closed

danusha2345 wants to merge 1 commit into
colbymchenry:mainfrom
danusha2345:fix/1959-lock-pid-only

Conversation

@danusha2345

Copy link
Copy Markdown
Contributor

Addresses ask 6 of #1959.

Problem

FileLock treated any lock older than two minutes as stale "regardless of PID status", and a live holder never refreshes the lock file. A sync that runs past two minutes is joined by the next one, and the two write the same rows at once. The report in #1959 has one sync running 75 minutes while newer syncs deleted the rows it kept adding.

Fix

The age test is gone: a lock is stale only when its PID is dead or unparseable. A holder that crashes still frees the lock, because its PID is dead. codegraph unlock stays the manual escape hatch the error message already names.

Tests

security.test.ts: a lock file backdated three minutes, holding a live PID, is still refused. Full suite on this branch (Linux, Node 22, native kernel): all tests pass except the known extraction.test.ts pool-worker crash from #1779 (fixed by #1883), which is intermittent and also occurs on main; that file alone passes 655/655.

🤖 Generated with Claude Code

@colbymchenry

Copy link
Copy Markdown
Owner

Thanks @danusha2345! Your commits here were carried into #2043 (authorship preserved), with a few follow-up changes from review, and that is now merged. Closing this one in favour of it. It will be in the next release.

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.

2 participants