beads/internal/lockfile/lock_shared_wasm.go
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

15 lines
323 B
Go

//go:build js && wasm
package lockfile
import "os"
// FlockSharedNonBlock is a no-op in WASM (single-process environment).
func FlockSharedNonBlock(f *os.File) error {
return nil
}
// FlockExclusiveNonBlock is a no-op in WASM (single-process environment).
func FlockExclusiveNonBlock(f *os.File) error {
return nil
}