Repository navigation
Closed
Description
.dag: issue-dag/2
.id: flyingrobots/devcontainers#12
.kind: task
.type: bug
.blocked_by: []
.size_hours: 6
area: `bin/devrun`, `tests/`, `docs/hygiene.md`
source: review of PR #11, which arrived after the mergeBug
1. Background Context
PR #11 removed devrun's machine-wide lock: runs now proceed in parallel under a cap, each worktree has its own build cache, --exclusive isolates timing runs, and --gc removes leftovers. It merged before its automated review finished. The review left four findings. They have been read against the code as described, not yet reproduced.
2. Problem Description
- Two
--commitruns of one worktree can share a stale build (major).--commitcopies get the current modification time so the cache does not serve another commit's build. Two concurrent--commitruns of different commits of the same worktree can both refresh their copies before either build starts; both copies then predate the first build's start, and the second run can reuse the first run's binary although its source differs. Evidence for a pinned commit must not depend on what else is running. - A surviving container is invisible to admission (major). If a runner process is killed with SIGKILL during its command, its admission locks vanish while its container keeps running. Another run can then exceed the cap, and an
--exclusivetiming run can start beside the survivor, which invalidates the timing. The same gap exists briefly on SIGTERM, where admission is released before cleanup stops the container. - An interrupted volume creation can leave an untracked volume (minor). If SIGTERM arrives after Docker creates a volume and before devrun records it, cleanup reports success, the liveness record is deleted, and
--gclater treats the volume as unknown. --gccan drop a dead run's record when inspection fails (minor)._inspectreturns an empty list whendocker inspectexits non-zero with empty output, so a resource that still exists can look absent, the run record is unlinked, and later--gcruns lose the evidence that the run is dead.
2b. Proposed Solution
- Hold a per-source lock across the timestamp refresh and the build for
--commitruns that share a target volume, or give pinned-commit runs a target keyed by the commit; add a concurrent regression test for the ordering described. - Make admission count live command containers (by label), not only live runner processes, and keep a run's admission until its container is confirmed stopped.
- Record the intent to create a volume before creating it and resolve that state during cleanup.
- Treat an inspect failure as an error unless every missing name is confirmed absent by a fresh listing.
2d. Acceptance Criteria
- Each case has a test that fails before the fix (real Docker for 1 and 2; real file locks and injected failures for 3 and 4).
docs/hygiene.mdstates the guarantees and their limits.
Metadata
Metadata
Assignees
Labels
No labels
Activity