Skip to content
LatchkeyLatchkey home

Self-Healing CI: Recovering Exhausted /dev/shm Shared Memory

A browser or process that crashes because /dev/shm is full hit a small shared-memory ceiling, not a bug -- more shared memory or a fallback flag fixes it.

The problem

A step crashes because the shared-memory filesystem (/dev/shm) ran out of space -- common with headless browsers and some databases that default to using it. The code is fine; the runner’s /dev/shm was too small for the workload. A human raises the shared-memory size or sets a fallback flag and the step passes unchanged.

Typical symptom
[crash] Failed to allocate shared memory: /dev/shm is full
# headless Chrome commonly hits this without --disable-dev-shm-usage

Why it happens

Some tools use the shared-memory tmpfs at /dev/shm for scratch space, and containers often mount it small by default. A workload that needs more shared memory than the small default provides exhausts it and crashes, even though plenty of regular memory is free.

It is a mechanical ceiling on one specific resource, not a code bug: giving the workload adequate /dev/shm (or pointing it at regular temp space) makes the same step succeed.

The manual fix

The manual fix is to provide adequate shared memory or a fallback, then retry:

  1. Increase the shared-memory size for the container/step.
  2. Use the tool’s fallback flag where it exists (e.g. headless Chrome’s --disable-dev-shm-usage).
  3. Re-run the step once shared memory is adequate.

How this gets automated

A /dev/shm exhaustion has a distinct shared-memory signature separate from a general OOM, and the right response is to provide adequate shared memory and retry. A self-healing CI pipeline detects the shared-memory exhaustion condition, retries the step with the resources it needs, and only escalates if the failure recurs with adequate shared memory, which would indicate a genuine leak rather than a small default.

Frequently asked questions

What causes Self-Healing CI: recovering exhausted /dev/shm shared memory?
A step crashes because the shared-memory filesystem (/dev/shm) ran out of space -- common with headless browsers and some databases that default to using it. The code is fine; the runner’s /dev/shm was too small for the workload. A human raises the shared-memory size or sets a fallback flag and the step passes unchanged.
How do I fix Self-Healing CI: recovering exhausted /dev/shm shared memory manually?
[object Object]
Can Self-Healing CI: recovering exhausted /dev/shm shared memory be fixed automatically?
A /dev/shm exhaustion has a distinct shared-memory signature separate from a general OOM, and the right response is to provide adequate shared memory and retry. A self-healing CI pipeline detects the shared-memory exhaustion condition, retries the step with the resources it needs, and only escalates if the failure recurs with adequate

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card