Skip to main content

Module exit_reason

Module exit_reason 

Source
Expand description

Exit reason hints for finished executions.

A numeric exit code alone is frequently misleading: a Bun/Node process that exhausts its heap aborts itself, so the container reports exitCode 139 with OOMKilled false even though the run died of memory exhaustion (issue #162, related to #144, #148 and #151). start already reads the tail of the log to find the terminal footer, so the same tail is scanned for well-known fatal markers and the finding is surfaced as an extra exitReason field.

The same scan answers a narrower question for consumers that key off oomKilled: was this run killed by memory exhaustion at all? That answer is surfaced as memoryExhausted plus memoryExhaustedReason, the log line that carried the evidence (issue #165).

Both fields are hints, never verdicts: they never change status, exitCode or oomKilled.

Structs§

ExitCodeDescription
A decoded exit code: the numeric value, the signal it encodes (if any), and the human-readable rendering both the container post-mortem and --status print.
ExitReasonMarker
A fatal marker found in the log: its category and the line that carried it.
MemoryExhaustion
The memory-exhaustion observation derived from a log tail (issue #165).

Constants§

CGROUP_OOM_EXIT_REASON
Reason reported when the container-wide OOM observation explains the exit.
SIGNAL_NAMES
Exit codes above 128 encode the signal that killed the process. Only the signals that actually show up in command logs are named.
UNKNOWN_EXIT_CODE
Text used wherever a fact could not be observed at all.

Functions§

describe_exit_code
Decode an exit code once, for every caller (issue #171.4).
describe_exit_code_str
Decode an exit code that arrived as text (e.g. from the watcher’s shell).
detect_exit_reason
Scan log text for a known fatal marker.
detect_memory_marker
Scan log text for a marker that reports memory exhaustion specifically.
find_exit_reason_marker
Scan log text for the first accepted fatal marker, most specific first.
is_oom_kill_of_command
Can a container-wide OOM observation be blamed on the command itself?
resolve_exit_reason
Resolve the best available hint for why an execution ended.
resolve_memory_exhaustion
Decide whether an execution died of memory exhaustion, and say why.
signal_name_for_exit_code
Map a shell exit code to the signal name it encodes.