Skip to content

The Expo dev server OOMs partway through the smoke suite, and the smokes report it as app failures #680

Open

Description

@thinkclay

What happens

Running the six browser smokes in scripts/audit/ back to back kills the Expo dev server partway through:

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

Everything after that point fails with net::ERR_CONNECTION_REFUSED and reports as a smoke failure, which is the actual damage: the run looks like the app is broken.

Observed three times in one session, at different points each time (after smoke-hydration, after smoke-mobile-nav case 2, after smoke-filter-chips). Setting NODE_OPTIONS=--max-old-space-size=8192 before pnpm web did not prevent it, so either the limit is not reaching the Metro/SSR worker process or the growth is unbounded rather than merely large.

Why it matters

With CI billing-blocked (#375), these smokes are the release gate. A gate that fails for environmental reasons is worse than no gate: the failures are indistinguishable from real ones without hand-checking each, and the natural response — re-run and see — is exactly how a real failure gets waved through.

Concretely, this run reported three failures that were all the dead server:

✗ smoke-mobile-nav    ERR_CONNECTION_REFUSED at /office/ats/admin
✗ smoke-filter-chips  ERR_CONNECTION_REFUSED at /office/ats/admin
✗ smoke-move-undo     ERR_CONNECTION_REFUSED at /office/applications

All three pass individually against a fresh server.

Two separable fixes

1. Make the smokes fail honestly. A connection refused is not an assertion failure. Each script should check the server is answering before it starts, and distinguish "the app is wrong" from "the harness lost its server" in both its exit code and its output. That is cheap and worth doing regardless of the memory question.

2. Find the growth. Whether this is Metro's transform cache, the SSR render path retaining per-request state, or simply a large bundle against a default heap is unknown. Worth measuring before tuning: a heap snapshot after N SSR renders of /office/ats/admin (the heaviest of the routes) would say quickly which it is.

Environment

  • Node v22.20.0, Expo SDK 56, macOS 24 GB
  • 12 Supabase containers resident alongside it
  • expo 56.0.18 (56.0.21 available — worth ruling in or out)

Acceptance

  • A smoke that cannot reach the dev server says so distinctly and does not report as an assertion failure
  • The six smokes run to completion back to back without the server dying

Activity

  1. added
    agent-ready
    on Sep 1, 2026
  2. thinkclay commented on Sep 15, 2026

    @thinkclay
    ContributorAuthor

    Related data from the nightly workflows, which were failing for an adjacent reason and are fixed in #770.

    The dev server was not starting at all in CI, for a reason unrelated to memory. E2E (nightly) was reporting

    Error: Timed out waiting 120000ms from config.webServer.
    

    which reads like the hang this issue describes, but is not. @scaffald/sdk is a submodule whose dist/ is gitignored and it has no prepare script, so pnpm install never builds it. The E2E workflow built @scaffald/ui alone, so the app it was waiting on could not resolve @scaffald/sdk/react. Lighthouse, which runs the same build without a server in front of it, reported the honest version:

    Unable to resolve module @scaffald/sdk/react from
    apps/scaffald/app/(admin)/office/cms/teams/[id]/edit.tsx
    

    Same root cause, two different-looking failures. Worth keeping in mind here too: a webServer timeout is not evidence of a hang. It is equally consistent with a server that exited immediately, or one that never got the chance to start.

    A measurement that bears on the memory question. The Lighthouse run on 1bdcc0dfd reported:

    Web Bundling failed 155505ms node_modules/expo-router/entry.js (8556 modules)
    

    So a cold web bundle is ~155s and 8556 modules on a CI runner. That is the working set this issue watches grow — useful as a baseline if anyone instruments the heap, and it is also why #770 raises the Playwright webServer timeout from 120s to six minutes. At 120s a working build could still report itself as a timeout, which is the same "environmental failure indistinguishable from a real one" problem this issue is about, one layer up.

    No progress on the OOM itself — this is context, not a fix.

  3. thinkclay commented on Sep 22, 2026

    @thinkclay
    ContributorAuthor

    Two mitigations landed in #855 (merged), and a measured cadence for the failure.

    scripts/audit/sweep-routes.mjs now:

    • Exits EXIT_INFRA (97) with a diagnosis the moment the dev server stops answering, instead of recording every subsequent route as a failure. On the release-1 integration branch it had produced 140 invented route failures on a branch whose whole purpose was proving nothing broke. lib/dev-server.mjs already existed for exactly this and already said a smoke that cannot reach the server exits INFRA, never 1 — the sweep used its preflight but not its mid-run check.
    • Writes its report after every capture, so a crash keeps its data. The PNGs were always on disk; the facts that make them readable were lost with the process.

    Measured cadence, five runs on 2026-09-21/22: the server dies at roughly 25–30 minutes / 65–75 captures, consistently. A full 196-capture sweep cannot complete in one process. Chunking with SWEEP_ONLY=<prefix> works reliably.

    That is a workaround, not a fix — this issue is still the fix. But the harness no longer lies about whose fault it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-ready

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions