WS-C3 Single-instance advisory lock keyed on DB path #291

Closed
opened 2026-07-31 18:14:14 +00:00 by KofTwentyTwo · 1 comment
KofTwentyTwo commented 2026-07-31 18:14:14 +00:00 (Migrated from github.com)

Prevent two daemons sharing one DB (only incidental port collision protects today). Size S.

Roadmap-to-9/10 (design: scratchpad/design/). Serial PROTO queue via WS-A. Brief at dispatch. DoD per docs/STORY-WORKFLOW.md.

Prevent two daemons sharing one DB (only incidental port collision protects today). Size S. Roadmap-to-9/10 (design: scratchpad/design/). Serial PROTO queue via WS-A. Brief at dispatch. DoD per docs/STORY-WORKFLOW.md.
KofTwentyTwo commented 2026-07-31 20:55:15 +00:00 (Migrated from github.com)

Delivered via PR #346 (WS-C3, squash-merged to dev). InstanceLock (crates/nunciod/src/lock.rs) takes an exclusive OS advisory lock on <db_path>.lock via fs4 (flock/LockFileEx) at startup BEFORE opening the store; held for the whole process lifetime, released after db.close() on clean exit. Contention -> honest InstanceLockError::AlreadyRunning naming the DB path, process exits non-zero without opening the store. New dep fs4 (no portable std file-lock; avoids PID-file staleness). 4 tests incl. double-acquire. Prevents two daemons corrupting one DB.

Delivered via PR #346 (WS-C3, squash-merged to dev). InstanceLock (crates/nunciod/src/lock.rs) takes an exclusive OS advisory lock on <db_path>.lock via fs4 (flock/LockFileEx) at startup BEFORE opening the store; held for the whole process lifetime, released after db.close() on clean exit. Contention -> honest InstanceLockError::AlreadyRunning naming the DB path, process exits non-zero without opening the store. New dep fs4 (no portable std file-lock; avoids PID-file staleness). 4 tests incl. double-acquire. Prevents two daemons corrupting one DB.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: KofTwentyTwo/nuncio#291