Skip to content
Latchkey

Cypress "out of memory or has crashed" - Browser Crash in CI

The browser Cypress drives ran out of memory and was killed mid-run. Chromium accumulates DOM snapshots and memory across a long spec, and a small container shared-memory limit makes it crash.

What this error means

The run dies with "The Test Runner unexpectedly exited" and "We detected that the Chromium Renderer process just crashed... the browser ran out of memory." Remaining specs are skipped; it is an infrastructure crash, not an assertion failure.

Cypress output
The Test Runner unexpectedly exited via a exit event with signal SIGTRAP

We detected that the Chromium Renderer process just crashed.
This is the equivalent to seeing the 'sad face' when Chrome dies.
... the browser ran out of memory.

Diagnose it: browser, server, or timing?

End-to-end failures in CI are dominated by three causes that have nothing to do with the test: the browser binary is missing, the application under test is not listening yet, or the test raced the page. Establish which before reading the assertion.

Terminal
# 1. are the browsers actually installed in THIS job?
npx playwright install --with-deps chromium
npx playwright --version

# 2. is the app up before the tests start?
npx wait-on http://localhost:3000 --timeout 60000

# 3. capture evidence for the failure you cannot reproduce
npx playwright test --trace on --video retain-on-failure

Common causes

Snapshot memory growth over a long spec

Cypress keeps command snapshots for time-travel debugging. Across hundreds of commands in one spec, browser memory climbs until the renderer is OOM-killed.

Small container shared memory (/dev/shm)

Docker defaults /dev/shm to 64 MB. Chromium uses shared memory heavily and crashes when it is exhausted on a constrained CI container.

How to fix it

Reduce snapshot memory pressure

Turn down numTestsKeptInMemory and disable in-memory snapshots in CI runs.

cypress.config.js
// cypress.config.js
module.exports = {
  numTestsKeptInMemory: 0,
  e2e: { experimentalMemoryManagement: true },
};

Give Chromium more shared memory

Terminal
# Docker: raise /dev/shm or disable Chromium's use of it
docker run --shm-size=2g ...
# or pass the flag to the browser
# launchOptions.args.push('--disable-dev-shm-usage')

Make the browser cache safe

  • Key the browser cache to the exact test-runner version. A cache restored from a different version gives you a binary that does not match the client and fails in a way that reads like a missing install.
  • Install browsers after dependencies, not before; a dependency install can replace the package that owns the browser path.
  • Prefer the vendor container image when the runner allows it. It removes the whole class of missing-system-library failures.

How to prevent it

  • Set experimentalMemoryManagement and a low numTestsKeptInMemory in CI.
  • Run on containers with --shm-size raised (or --disable-dev-shm-usage).
  • Split very long specs to cap per-spec memory growth.

Frequently asked questions

What causes Cypress "out of memory or has crashed"?
There are 2 common causes: snapshot memory growth over a long spec and small container shared memory (/dev/shm). Cypress keeps command snapshots for time-travel debugging.
How do I fix Cypress "out of memory or has crashed"?
There are 2 fixes depending on which cause you have: reduce snapshot memory pressure and give chromium more shared memory. Work through them in order, since the first is the most common.
What does Cypress "out of memory or has crashed" actually mean?
The run dies with "The Test Runner unexpectedly exited" and "We detected that the Chromium Renderer process just crashed...
How do I stop Cypress "out of memory or has crashed" happening again?
Set experimentalMemoryManagement and a low numTestsKeptInMemory in CI. 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 is an out-of-memory kill, not an application error. Latchkey detects, repairs, and retries it for you. Start free → 30-day trial · No credit card