beads/internal/lockfile
beads/crew/emma 1269368593 fix: advisory flock to prevent zombie bd processes from dolt lock contention
Replace ProcessSemaphore (counting semaphore with N slots) with advisory flock
on .beads/dolt-access.lock. Readers acquire shared locks (concurrent), writers
acquire exclusive locks (serialized). This prevents multiple bd processes from
competing for dolt internal LOCK file, which caused zombie hangs.

Key changes:
- Add FlockSharedNonBlock/FlockExclusiveNonBlock to lockfile package (unix/windows/wasm)
- Add AccessLock with poll-based acquisition and configurable timeout
- Integrate lock acquire/release in DoltStore.New()/Close() and error paths
- Replace ProcessSemaphore in main.go with OpenTimeout (5s read, 15s write)
- Remove dead ProcessSemaphore code

Co-Authored-By: beads/crew/lydia <steve.yegge@gmail.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-02 22:41:18 -07:00
..
lock.go fix: advisory flock to prevent zombie bd processes from dolt lock contention 2026-02-02 22:41:18 -07:00
lock_shared_unix.go fix: advisory flock to prevent zombie bd processes from dolt lock contention 2026-02-02 22:41:18 -07:00
lock_shared_wasm.go fix: advisory flock to prevent zombie bd processes from dolt lock contention 2026-02-02 22:41:18 -07:00
lock_shared_windows.go fix: advisory flock to prevent zombie bd processes from dolt lock contention 2026-02-02 22:41:18 -07:00
lock_test.go fix: detect and clean stale Dolt lock files (gt-dolt-lockfiles) 2026-01-30 23:49:44 -08:00
lock_unix.go fix: detect and clean stale Dolt lock files (gt-dolt-lockfiles) 2026-01-30 23:49:44 -08:00
lock_wasm.go fix: detect and clean stale Dolt lock files (gt-dolt-lockfiles) 2026-01-30 23:49:44 -08:00
lock_windows.go fix: detect and clean stale Dolt lock files (gt-dolt-lockfiles) 2026-01-30 23:49:44 -08:00
process_unix.go fix: eliminate 5+ second delays from stale daemon.lock files (bd-htwx) 2025-12-31 13:03:49 -08:00
process_wasm.go Standardize daemon detection with tryDaemonLock probe (bd-wgu4) 2025-11-07 21:02:38 -08:00
process_windows.go fix: eliminate 5+ second delays from stale daemon.lock files (bd-htwx) 2025-12-31 13:03:49 -08:00