## TL;DR
Chrome crashes in small CI containers because the shared-memory partition it renders into is tiny, and under memory pressure the whole browser dies before Cypress can connect. Pass `--disable-dev-shm-usage` in the browser launch args so Chrome uses disk-backed temp space instead, cut the number of parallel browser workers, and the browser stays alive long enough to run your suite.

```text
cypress "The browser never connected"  -  Chrome crashing under CI memory pressure: how to fix
```

## Steps
1. Check the CI job's memory limit and how many Cypress browser workers run at once. Compare with the size of `/dev/shm` inside the container. Expected: you confirm the container is memory-tight (small shm, several workers).
2. Add the launch flag in your Cypress config so Chrome avoids the tiny shared-memory partition:
```js
setupNodeEvents(on, config) {
  on('before:browser:launch', function(browser, launchOptions) {
    if (browser.name === 'chrome') {
      launchOptions.args.push('--disable-dev-shm-usage')
    }
    return launchOptions
  })
}
```
Expected: the config loads and the flag is present in the launch args.
3. Reduce parallel workers (fewer `--parallel` machines or a lower per-machine thread count) so each browser gets more headroom. Expected: peak memory per worker drops.
4. Rerun the suite in CI. Expected: Chrome launches, stays alive, and tests start instead of the "never connected" error.

## Use this when
- Cypress reports "The browser never connected" only in CI
- The CI container has limited memory or a small /dev/shm
- Chrome works locally but dies immediately in the pipeline

## Not for this skill when
- The browser launches but tests fail (that is a test problem, not a launch problem)
- The error names a GPU process crash (see the GPU-crash skill instead)
- The browser binary is missing or the version is wrong (install or pin the browser first)

## Variant phrasings
- cypress browser never connected in CI
- chrome crashing in cypress CI container
- cypress chrome died under memory pressure

## Why it happens
Chrome uses `/dev/shm` for rendering buffers, and Docker-style CI containers default that partition to 64MB. Under parallel test load Chrome exhausts it and the renderer crashes, taking the browser down before Cypress ever connects. Local machines have gigabytes of shared memory, which is why the bug is CI-only.

## Edge cases
- If crashes persist, raise the container memory limit or the shm size in the CI runner config; the flag is a workaround, not infinite headroom.
- Firefox has its own memory behavior and does not take the same flag; this fix is Chrome-specific.
- A crash that happens mid-suite rather than at launch points at a leaking page, not shm size. Watch memory across a single long spec to tell the two apart.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_VMz7VIXXSgVcbCyxxzT6vw
