mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-17 21:54:30 +01:00
Make gstack's shell locks hold when mkdir reports a race it lost (GST-2247) (#4262)
* Make gstack's shell locks hold when mkdir reports a race it lost (GST-2247) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * Fix lock tests and fixtures for gstack_lock_take; trim setup-gbrain lock prose Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * Ship the lock helper with every copied runtime and fixture that runs a lock The Claude Code wrapper's copied runtime now includes bin/gstack-lock.sh, and bin/gstack-render-claude.sh sources it beside itself, so gstack-config set works in a copied runtime and the render lock is taken by every caller. Test fixtures that copy single bin scripts now copy the helper too, and the mkdir lock guard is registered as a repo-wide docs reader. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * Release a lock whose owner file could not be fully written gstack_lock_take created the owner file with a noclobber redirect and, when that redirect failed, treated an existing file as a competing holder. If the file was created but the write then failed (disk full, quota, ulimit -f), the helper found its own empty file, returned 1 and left a lock nobody held; freeze's state lock has no stale recovery, so it stayed busy until removed by hand. The helper now tells "opened but write failed" from "already held", removes its own file and directory, and returns 3. The inline copy in gstack-ff-update is updated byte for byte, and a new test under ulimit -f 0 fails on the old helper. Review-Finding: s11/outside-voice#1 reader=outside-voice Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * Describe the lease lock as gstack_lock_take's O_EXCL owner file Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
76fad3edd9
commit
bcece3fbcd
50 files changed
+621
-154
No files matched your search
@@ -6,8 +6,10 @@
|
||||
* (`./evals.sh case <id>`) and a gate command (`./evals.sh gate`), all local
|
||||
* stubs that cost nothing. The rule case `queue-priorities` reads a task list
|
||||
* that storage returns in seed-dependent order and compares it to the sorted
|
||||
* expectation. Each `case` invocation claims the lowest free trial slot with
|
||||
* an atomic `mkdir` (slots reset per ship-measure round, keyed on the round
|
||||
* expectation. Each `case` invocation claims the lowest free trial slot by
|
||||
* creating its slot file with noclobber, which the shell opens O_EXCL (not
|
||||
* mkdir, whose exit status lies on Ubuntu 26.04's uutils mkdir; slots reset
|
||||
* per ship-measure round, keyed on the round
|
||||
* directory), and the slot is the seed: while src/priorities.js leaves the
|
||||
* list unsorted, slots whose number mod 10 is 2, 5 or 9 fail (3 of 10). The
|
||||
* failure prints `failure_cause` and `failure_detail` naming the line. The
|
||||
@@ -84,7 +86,7 @@ case "\${1:-}" in
|
||||
case "$id" in ${SEEDED_CASE}|${STABLE_CASE}) ;; *) echo "unknown case: $id (cases: ${SEEDED_CASE}, ${STABLE_CASE})" >&2; exit 2 ;; esac
|
||||
if [ -n "\${GSTACK_SHIP_MEASURE_DIR:-}" ]; then slots="$(dirname "$GSTACK_SHIP_MEASURE_DIR")/slots"; else slots="$here/.evals/slots"; fi
|
||||
mkdir -p "$slots"
|
||||
n=1; until mkdir "$slots/$n" 2>/dev/null; do n=$((n + 1)); done
|
||||
n=1; until (set -o noclobber; : > "$slots/$n") 2>/dev/null; do n=$((n + 1)); done
|
||||
out=$(run "$id" "$n" 2>&1); rc=$?
|
||||
printf '%s\\n' "$out"
|
||||
echo "case id=$id slot=$n sorted=$(sorted_of "$out") result=$([ $rc = 0 ] && echo pass || echo fail) measure_dir=\${GSTACK_SHIP_MEASURE_DIR:--}" >>"$log"
|
||||
|
||||
Reference in new issue
Block a user