From 22c67f1cb8304e612c13035ab34bb5e7f18ce2a1 Mon Sep 17 00:00:00 2001 From: prosolis <5590409+prosolis@users.noreply.github.com> Date: Sun, 23 Aug 2026 12:49:32 -0700 Subject: [PATCH] Record the two shell traps that wedged session 2's background jobs Eleven watcher shells and one MAME instance were left running for over an hour. Both had the same shape: a wait that can never be satisfied. - `until ! pgrep -f foo.py` matches the watching shell's own command line, so the loop never terminates. Wait on a PID or a sentinel file instead. - `timeout N mame` sends a SIGTERM that MAME ignores when its autoboot script is blocked; without `-k` the process spins at 100% CPU forever. Also gitignore vasm's default `a.out` output. Claude-Session: https://claude.ai/code/session_01194oWYW8DQXK1SZ2DnChW6 --- .gitignore | 1 + docs/STATUS.md | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index e230db6..b50d4a3 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ roms/ __pycache__/ *.pyc *.dlx +a.out diff --git a/docs/STATUS.md b/docs/STATUS.md index a3e7f03..a52eefa 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -117,6 +117,15 @@ notifier subscription in a global; the stack register is `SP` not `A7`; - piping MAME (or any long job) through `grep` block-buffers — write to a file. - `pkill -f ` matches your own shell and kills it (exit 144). Use `pkill -x` or kill by PID. +- **`until ! pgrep -f foo.py; do sleep; done` watcher loops never exit.** The + watching shell's own command line contains the string `foo.py`, so `pgrep -f` + matches the watcher itself and the loop spins forever. Session 2 left 11 of + these wedged for over an hour. Wait on the PID (`while kill -0 $PID`) or on a + sentinel file the job touches when it finishes -- never on a `-f` name match. +- **`timeout N mame ...` does not kill MAME.** MAME catches SIGTERM and, with an + autoboot script blocked waiting on a flag that never arrives, never reaches + its shutdown path. `timeout` without `-k` then waits forever while MAME burns + a full core at `-nothrottle`. Always `timeout -k 5 N`. ---