fix(wake): close fd 9 in the detector's sleep child so a dead detector's lock dies with it #993

Merged
Mos merged 4 commits from fix/966-detector-lock-fd-leak into main 2026-07-31 13:48:34 +00:00
Showing only changes of commit da0cf00189 - Show all commits
@@ -529,6 +529,10 @@ cmd_run() {
echo "detector.sh: WARN — off-host liveness beacon emit failed (see beacon.sh); the off-host absence check remains the authoritative dead-man." >&2
fi
[ "$once" -eq 1 ] && break
# Close the detector lock fd in the sleep child; otherwise an orphaned sleep
# keeps the single-instance flock (fd 9, taken at exec 9> above) alive after
# the detector parent dies, and no replacement instance can ever acquire it.
# `9>&-` closes ONLY the child's copy — the parent's lock is unaffected.
sleep "$interval" 9>&-
done
}