Skip to content
Latchkey

/dev/shm Full During Browser Tests in CI

Chromium-based browsers use /dev/shm for shared memory. In CI that mount is often small (64MB in containers), so a heavy test run fills it and the browser crashes.

What this error means

Browser tests fail with tab crashes, Target closed, or No space left on device referencing /dev/shm. Reducing parallelism or enlarging shm makes it pass with no test change.

shell
[ERROR] Failed to write to /dev/shm: No space left on device
Page crashed! ProtocolError: Target.activateTarget: Target closed.

Common causes

The shared-memory mount is too small

Containers default /dev/shm to 64MB. Chromium can exceed that quickly with multiple tabs or large pages, exhausting the mount.

Too many parallel browser instances

Each headless browser consumes shm; running many in parallel multiplies the pressure on a small mount.

How to fix it

Enlarge /dev/shm or bypass it

Give the container more shared memory, or tell Chromium not to use it.

docker
# docker: enlarge shm
docker run --shm-size=2g my-tests
# or launch flag
chrome --disable-dev-shm-usage --no-sandbox

Lower browser parallelism

  1. Reduce the number of concurrent browser workers.
  2. Close pages/contexts promptly between tests.
  3. Run browser-heavy suites on a runner with more RAM.

How to prevent it

  • Set --shm-size for browser containers in CI.
  • Use --disable-dev-shm-usage for headless Chromium.
  • Cap browser worker concurrency to the runner size.

Related guides

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