Expand description
Runs a command that is expected to keep talking, and diagnoses it if it stops.
A coverage run hung for over an hour: two web integration tests stopped
producing output while the jobβs heartbeat kept pulsing, so nothing looked
wrong until the deadline killed it β with no indication of which tests were
responsible. Diagnosing it meant catching the pod live and hand-running
pg_stat_activity and /proc inspection before it disappeared. The next
occurrence should arrive already diagnosed.
Only for commands whose silence is itself a symptom. The musl link is quiet for twelve minutes and is perfectly healthy; wrapping that would be a way to kill good builds.
Re-exportsΒ§
pub use group::Termination;pub use supervised::run_supervised;
ModulesΒ§
- cpu π
- CPU time spent by a process and everything it spawned, read from
/proc. - group π
- The process group a watched command runs in, and the signals aimed at it.
- supervised π
- A command run in its own process group so a termination signal reaches all of it.
EnumsΒ§
- Verdict π
ConstantsΒ§
- BUSY_
TICKS π - CPU time the process tree must spend for its silence to count as work.
- REPORT_
LIMIT_ πSECS - How long one diagnostic may run; a hung
psqlmust not hold the failure back. - STALL
- How long a watched command may produce nothing and do no CPU work before it is declared stuck.
FunctionsΒ§
- database_
diagnostics π - The psql invocations that describe the database the child was given; none without one, since the ambient server is not the childβs.
- diagnose π
- Everything worth knowing about a stuck run, gathered with the process tree frozen, before it is killed, because killing it drops the database connections and the process tree being diagnosed.
- follow_
cpu π - Moves
marktoticksin either direction; true when the tree gained at leastBUSY_TICKSsince the mark. Following a drop keeps a total that fell from hiding later work. - pump π
- Forwards a stream line by line, recording when each line arrived.
- report π
- Best effort: a diagnostic that cannot run must not mask the stall itself.
- report_
within π - run_
watched - Runs a command, forwarding its output, and fails if it goes quiet.
- run_
watched_ for - As
run_watched, with the silence budget supplied. - watch π
- Polls the child until it exits, is told to stop, or goes quiet; on a stall the diagnostics are gathered here, with the group frozen but alive.