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)

Diagnose it: linker, target, or memory

Rust build failures in CI that are not compiler errors are usually a missing system linker or library, a target that is not installed, or the compiler being killed for memory.

Terminal
rustup target list --installed
cc --version || echo "no C toolchain: install build-essential"
free -h

# exit 137 during codegen is an out-of-memory kill, not a compile error
cargo build -j 2   # fewer parallel codegen units uses less memory

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.

Frequently asked questions

What causes Rust "rustc interrupted by SIGKILL" (OOM) in CI?
There are 2 common causes: peak memory exceeds runner ram and too much build parallelism. 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.
How do I fix Rust "rustc interrupted by SIGKILL" (OOM) in CI?
There are 2 fixes depending on which cause you have: lower memory pressure and build on a larger runner. Work through them in order, since the first is the most common.
What does Rust "rustc interrupted by SIGKILL" (OOM) in CI actually mean?
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.
How do I stop Rust "rustc interrupted by SIGKILL" (OOM) in CI happening again?
Cap CARGO_BUILD_JOBS and codegen units on memory-tight runners. The prevention section lists 3 changes that keep it from recurring.
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.

Related guides

References

This one is intermittent by nature. Latchkey detects, repairs, and retries it for you. Start free → 30-day trial · No credit card