Skip to content

[Bug]: Orca attributes 54-120 GB to a 1.3 GB Next/Turbopack terminal and becomes unresponsive #10768

Closed

Description

@ryushione

Operating system

macOS

Orca version

1.4.156

Details

Short summary

A high-CPU Next.js 16 Turbopack process inside an Orca-managed terminal causes Orca's resource accounting to attribute an impossible 54-120 GB to that terminal process tree. Orca then becomes unresponsive and requires a force quit.

The child process did consume substantial resources, but its measured RSS was approximately 1.3 GB, not tens of gigabytes. The host has 51.5 GB physical RAM.

This reproduced twice. The second reproduction required force-quitting Orca.

Environment

  • macOS
  • Orca 1.4.156
  • Node 24.18.0
  • pnpm 10.33.4
  • Next.js 16.2.11
  • Local Orca-managed terminal
  • 51.5 GB physical memory
  • No swap or compression pressure before reproduction

Steps to reproduce

  1. Open a Next.js 16 application in an Orca-managed worktree terminal.

  2. Run a development script that resolves to:

    next dev --port 3001
    

    Next reports Next.js 16.2.11 (Turbopack).

  3. Request several application routes so Turbopack starts compiling them.

  4. Observe the Next process and orca diagnostics memory --json.

No Turbopack trace is attached because reproducing the issue again risks another forced restart.

Actual behavior

During the captured reproduction:

  • next-server RSS: approximately 1.33 GB
  • next-server CPU: approximately 356%
  • Orca attribution for the terminal: 54.23 GB memory and 904.5% CPU
  • Orca attribution for the worktree: 54.65 GB
  • Orca diagnostics reported the 51.5 GB host at 99.69% used
  • The user subsequently observed approximately 120 GB attributed during the repeated incident
  • Orca became unresponsive and had to be force-quit

After restarting Orca, its app memory returned to approximately 1.65 GB and the host returned to normal.

The 54-120 GB values cannot represent resident memory on this host. This looks like process-tree double counting, virtual-memory/footprint accounting, or another runaway attribution path. It is unclear whether the same accounting result also drives a renderer allocation or resource-manager feedback loop.

Control comparison

The same application, Node version, terminal ownership, and routes were tested with:

next dev --webpack --port 3001

Results after compilation:

  • next-server RSS: approximately 1.78 GB
  • CPU settled near 1%
  • Orca attributed approximately 2.20 GB to the entire terminal
  • Orca stayed responsive
  • Closing the terminal removed the process tree and released port 3001

This indicates that Turbopack's sustained compile load is a reliable trigger, but the impossible memory attribution and Orca failure are Orca-side behavior.

Expected behavior

  • A busy child process must not make Orca attribute more memory than exists on the host.
  • Resource Manager and orca diagnostics memory should report a non-duplicated resident/footprint measurement with documented semantics.
  • Orca should remain responsive enough to stop the offending terminal.
  • If a terminal exceeds a safe resource threshold, Orca should surface the actual child process and allow bounded termination rather than entering a state that requires force quit.

Workaround

All affected local applications now explicitly use next dev --webpack and pin Node 24. This avoids the known trigger but does not repair Orca's accounting/failure behavior.

Related recent work

v1.4.156 includes renderer OOM diagnostics (#9984). The broad memory-bounding change #10179 was included and then reverted in the same release. This incident still reproduces on the released 1.4.156 build.

Activity

  1. nwparker commented on Jul 27, 2026

    @nwparker
    Contributor

    I investigated this against the current collector and reproduced both the accounting behavior and the Next.js trigger.

    There are two separate effects here:

    1. The 54–120 GB terminal value has misleading macOS RSS semantics. Orca runs ps -eo pid=,ppid=,pcpu=,rss=, converts RSS from KiB to bytes, walks each PTY subtree, and globally deduplicates PIDs. This rules out the same PID being counted repeatedly by the tree walk. However, macOS RSS is not a unique physical-footprint measurement: aliased/shared resident pages can be counted repeatedly, and summing RSS across a process tree compounds that. In a controlled test, mapping one 64 MB backing file 800 times produced about 52.5 GiB of ps RSS and 50–53 GiB of Orca attribution while vmmap reported only about 26–28 MB of physical footprint.

      The host percentage is also not a memory-pressure reading: Orca currently reports os.totalmem() - os.freemem() as used memory. On macOS that excludes important available/reclaimable-memory semantics and can read near 100% without meaning the same thing as Memory Pressure.

    2. Next.js 16.2.11 also has a real native runaway that can exhaust the machine. I pinned the public intoRandom/next-global-not-found-import-bug reproduction to Next 16.2.11 and triggered it by requesting /, /path, and several unmatched routes including /nope.png. The bounded run reached roughly 1,034% CPU. At capture time the next-server process had 24,047,488 KiB RSS, while vmmap reported an 18.2 G physical footprint (19.8 G peak) and 25.0 G resident regions. Sampling showed the active path inside next-swc.darwin-arm64.node. Orca's corresponding worktree sample was 25,426,755,584 bytes. Stopping the terminal released roughly 25 GB of host memory.

    This closely matches vercel/next.js#92256, including the global-not-found import trigger, sustained native CPU loop, Next 16.2.11, and the webpack control. The reporter there found the issue appears fixed in 16.3.0-preview.9. Related native/worker growth is also documented in #92055, #91585, #92978, and #95108.

    I also exercised the real Resource Manager collector and open popover under a synthetic 131-session load. Snapshot IPC remained 33–45 ms, peak renderer timer lag was 8.4 ms, post-GC renderer heap growth was 1.65–4.06 MB, and there was no render-process-gone. The renderer replaces each snapshot and the collector retains at most 60 numeric history samples, so I found no path where a large displayed number creates a proportional renderer allocation. Retained crash reports/traces likewise did not show a matching renderer V8 OOM.

    Current conclusion: Orca's displayed values need corrected/documented macOS accounting semantics, but the force-quit incident is best explained by Orca becoming collateral damage when the Next/Turbopack native loop consumes cores and real system memory. The huge displayed value itself is not causing a Resource Manager allocation feedback loop.

    Workarounds: use next dev --webpack, remove imports from the affected global-not-found.tsx, or move to a Next 16.3 build containing the upstream correction once an appropriate version is available.

    I'm keeping this issue open because the Orca accounting defect remains. I will address that in a separate PR, isolated from unrelated work.

  2. nwparker commented on Jul 27, 2026

    @nwparker
    Contributor

    the tl;dr BTW is that we will change the way we count.
    But the unresponsiveness as far as I can tell was your whole computer slowing down

  3. nwparker commented on Jul 27, 2026

    @nwparker
    Contributor

    Will leave this open for 3 days!
    I merged some accounting changes above ^

  4. added
    bug
    on Jul 27, 2026
  5. nwparker commented on Jul 27, 2026

    @nwparker
    Contributor

    Repro status: cannot_repro (cannot safely force host OOM)

    Attempt

    Report: Next.js Turbopack ~1.3 GB RSS attributed as 54–120 GB, freezing Orca.

    What we checked

    Memory collector (src/main/memory/collector.ts) uses ps RSS with subtree walk and a claimed-pid set to avoid double-counting shared ancestors. Host metric uses free-memory / memory_pressure. No obvious code path that multiplies RSS by ~40× without a bad sample or host metric misread.

    Conclusion

    Cannot reproduce the 54–120 GB figure without re-running the high-CPU Turbopack workload to OOM risk. If reproducible, capture orca diagnostics memory --json + ps -o pid,rss,command -p <next-pid> side-by-side at peak.

  6. added
    pending_repro
    on Jul 27, 2026
  7. nwparker commented on Aug 1, 2026

    @nwparker
    Contributor

    Will leave this open for 3 days! I merged some accounting changes above ^

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

Metadata

Metadata

Assignees

Labels

bugpending_repro

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions