mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-10 12:47:04 +00:00
test(rescue): start the drill's kill clock only once the stand-in is armed
BudgetKillDrillTests drove the stand-in deploy with `timeout -k GRACE 3`. Under load (gate pass 76 ran unit, integration and lint in parallel) timeout's TERM arrived while bash was still starting, before the stand-in's `trap cleanup EXIT` existed, so bash died on TERM without the rescue: test_without_the_window_the_kill_lands_before_the_copy failed with "124 != 137" and only "kill_epoch=…" on stdout. A 4 s stall before the trap reproduces it on the old driver; nothing in the merge touched the rescue code. The stand-in now writes to an `armed` FIFO right after it installs the trap. The driver runs `timeout -k GRACE 0 …` (duration 0 disables timeout's own clock, its TERM-then-KILL handling stays), waits for `armed`, sleeps until the deadline epoch and sends timeout the same ALRM its own expiry raises, so TERM still lands at the deadline and KILL GRACE seconds later, with the same 124/137 exit codes. `wait -n -p` lets the failure-before-the-deadline drill return as soon as its deploy ends. No timeout was raised and nothing retries; with the 4 s stall all three drills pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2656a0f119
commit
91f25a35f2
1 file changed
+17
-1
@@ -44,7 +44,22 @@ if [ "${EPOCHS}" = true ]; then
|
||||
export INFINITO_CI_DISTRO_KILL_EPOCH="$((deadline + GRACE))"
|
||||
fi
|
||||
echo "kill_epoch=$((deadline + GRACE))"
|
||||
timeout -k "${GRACE}" "$((deadline - now))s" bash "${SANDBOX}/stand-in.sh" "$@"
|
||||
mkfifo "${SANDBOX}/armed"
|
||||
timeout -k "${GRACE}" 0 bash "${SANDBOX}/stand-in.sh" "$@" &
|
||||
deploy="$!"
|
||||
read -r _ <"${SANDBOX}/armed"
|
||||
left="$((deadline - $(date +%s)))"
|
||||
sleep "$((left > 0 ? left : 0))" &
|
||||
clock="$!"
|
||||
status=0
|
||||
wait -n -p first "${deploy}" "${clock}" || status="$?"
|
||||
if [ "${first}" = "${clock}" ]; then
|
||||
kill -ALRM "${deploy}"
|
||||
wait "${deploy}" || status="$?"
|
||||
else
|
||||
kill "${clock}"
|
||||
fi
|
||||
exit "${status}"
|
||||
"""
|
||||
|
||||
STAND_IN = """\
|
||||
@@ -65,6 +80,7 @@ cleanup() {
|
||||
date +%s >"${SANDBOX}/rescued"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
echo armed >"${SANDBOX}/armed"
|
||||
"$@"
|
||||
"""
|
||||
|
||||
|
||||
Reference in new issue
Block a user