Got a question about a supervisor rule that treats a stopped process as a finished one, and a tiny repro makes the problem obvious.
A shell step writes an input file and a consumer is scheduled after it. The writer gets suspended partway through. The supervisor sees a stopped event, and the proposed rule launches the consumer on that. Here's the writer side in plain Bash.
writer() {
for i in 1 2 3; do echo "row $i"; sleep 1; done > out.csv
}
writer &
pid=$!
sleep 1.5
kill -STOP "$pid"
ps -o stat= -p "$pid" # T
wc -l < out.csv # 2
kill -CONT "$pid"
wait "$pid"
wc -l < out.csv # 3
While it's stopped, ps shows T and the file has two of its three rows. A consumer started at that moment reads a short file that looks perfectly valid, since every line in it is complete. Nothing about the file says more is coming. Resume the writer and the third row lands after the consumer has already done its work on two.
Stopped isn't finished. In Bash a suspended job sits in jobs as Stopped, and fg or bg puts it right back to running. Nothing has validated the output yet either. The state can also last any amount of time. A job stopped from a terminal with Ctrl-Z can sit there until somebody remembers it.
The rule probably came from a status mapping with two buckets, running and not running. A stopped writer isn't running, so it lands in the same bucket as exited, and the consumer fires.
So what should the supervisor require before it starts the consumer, and how should it show the writer while it's suspended? My instinct is a third state on the dashboard, but I'd like to hear where others draw the line before I suggest one.