Skip to content
Latchkey

Rust "rustc interrupted by SIGKILL" (OOM) in CI

rustc was killed by the kernel's OOM killer (signal 9). The compilation's peak memory exceeded what the runner had free, so the process was terminated mid-codegen rather than failing gracefully.

What this error means

The build dies with error: rustc interrupted by signal 9 (SIGKILL) or simply vanishes with exit 137, often on a large crate or with high codegen parallelism. It can be intermittent depending on concurrent load.

cargo
error: rustc interrupted by signal 9 (SIGKILL)
note: the compiler unexpectedly panicked. this is a bug.
# (often paired with an exit code of 137)

Common causes

Peak memory exceeds runner RAM

A heavy crate, many parallel codegen units, or debug info inflates rustc's memory above the runner's limit and the OOM killer steps in.

Too much build parallelism

Several rustc processes compiling in parallel multiply peak memory beyond what the box can hold.

How to fix it

Lower memory pressure

Reduce parallelism and codegen units, and trim debug info, to cut peak memory.

.github/workflows/ci.yml
export CARGO_BUILD_JOBS=2
export RUSTFLAGS="-C codegen-units=1"
# in Cargo.toml profile: debug = "line-tables-only"
cargo build --locked

Build on a larger runner

More RAM removes the ceiling rustc is hitting.

.github/workflows/ci.yml
runs-on: latchkey-large # more memory per job

How to prevent it

  • Cap CARGO_BUILD_JOBS and codegen units on memory-tight runners.
  • Reduce debug info in CI profiles.
  • On self-healing managed runners (Latchkey), an OOM-killed build is auto-retried with larger RAM and the cargo registry stays cached, so a transient memory spike does not fail the pipeline.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →