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
This commit is contained in:
@@ -11,3 +11,4 @@ roms/
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
*.dlx
|
*.dlx
|
||||||
|
a.out
|
||||||
|
|||||||
@@ -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.
|
- piping MAME (or any long job) through `grep` block-buffers — write to a file.
|
||||||
- `pkill -f <pattern>` matches your own shell and kills it (exit 144).
|
- `pkill -f <pattern>` matches your own shell and kills it (exit 144).
|
||||||
Use `pkill -x` or kill by PID.
|
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`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user