Repository navigation
fix(lock): bound the blocking acquire — fail fast on a contended flock - #73
Conversation
Review — BLOCKHead SHA: Change class: runtime/code change (Go Security screen: PASS — no secrets, no exfiltration, no scope mismatch (diff matches description), no guardrail weakening (this bounds a lock wait — a hardening, not a loosening). Blocks
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Review — BLOCKHead SHA: Change class: runtime/code change (Go Security screen: PASS — no secrets/exfiltration, no scope mismatch (diff matches description), no guardrail weakening (this bounds a lock wait — a hardening). Blocks
Comment intake
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Review — PASSHead SHA: Security screen: PASS — no secrets/exfiltration, no scope mismatch (diff is exactly Checklist: All applicable rules PASS or NA.
Comment intake:
Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
This repo had NO Go CI: only pr-validator.yml and tag-on-merge.yml, neither of which builds, tests or lints the module. The only enforcement was the local pre-commit hook, so nothing kept main green between commits. The drift is not hypothetical, and it recurs. opencharly/charly#464 measured 11 findings on this repo's main on 2026-08-29; #68 cleared them; main has 2 again today, from #73: lock/filelock_timeout_test.go:25:15: Error return value of `f.Close` is not checked lock/filelock_timeout_test.go:30:15: Error return value is not checked Both are deferred calls in a test whose errors were never meant to be consumed; they are made explicit rather than silenced, so the gate lands green. That recurrence is the argument for the gate. Because the hook lints the WHOLE repo rather than the diff, these two findings would have blocked the next contributor to touch this repo — someone with no connection to #73. golangci-lint is pinned by module version rather than a third-party action, so the CI binary is the same build the hook uses locally and a new upstream release cannot turn main red on its own schedule. Second instance of the go-ci-lint-parity batch, after opencharly/charly#486. Claude-Session: https://claude.ai/code/session_016fnPmYiC6ZkqXSi6D8PAP6 Co-authored-by: atrawog <[email protected]>
Summary
The recurring fleet-del stall (VM beds' cleanup hanging in futex_wait) has a THIRD unbounded wait, distinct from the two already fixed in sdk#191 (engine command + agentkit store lock):
lock.AcquireFileLock(spec/lock/filelock.go) ransyscall.Flock(LOCK_EX)with NO timeout whenblocking=true. A goroutine dump from the stuckcharly fleet delshows it parked inspec/lock.AcquireFileLockfor 14 minutes.Fix: the blocking acquire now polls
LOCK_NBwith a 50ms interval, failing fast afterlockTimeout(2 min, a package var for testability) instead of blocking forever on a contended lock. The non-blocking path is unchanged.How tested
The regression test holds the lock on a separate fd and asserts the blocking acquire fails fast within 200ms (the test's shortened timeout). It would hang forever without the fix.
Fresh-rebuild full suite (committed tree, non-/tmp checkout — the $TMPDIR tests require the checkout not under /tmp):
The two proc tests (TestSweepStaleTemps_HonoursTMPDIR, TestOpenedFilesByAnyProcess_HonoursTMPDIR) self-guard against a /tmp checkout; from a non-/tmp checkout of the same commit they pass. The PR touches only lock/.
Live load-test bed run (concurrent flock contention, -race, from the committed tree):
The load test holds LOCK_EX on a separate fd and runs 8 concurrent blocking acquires (all fail fast within the 2s shortened timeout, no hang), then releases and runs 8 concurrent success-path acquires (all succeed).
Rulebook compliance
Change classification
Assisted-by: pi openrouter/deepseek/deepseek-v4-flash-0731 (fully tested and validated)