[2.5.5 / macOS] Main process crashes with V8 heap OOM after repeated file-watcher event storms (node_modules)

Summary

The Antigravity IDE main (browser) process runs out of V8 heap and crashes every 6–38 hours. All 7 crash dumps since 27 Sep are the same failure. Every crash follows a burst of file-watcher events from a node_modules tree inside the workspace being rewritten (npm ci, or deleting a git worktree).

This looks like the same trigger as Critical macOS Crash & 40GB Memory Exhaustion Caused by Recursive Workspace Indexing, which was marked resolved in 2.0.4. It still happens on 2.5.5, in a different process: here the main process hits its own 4 GiB heap limit, rather than the whole system running out of memory.

Environment

  • Antigravity IDE 2.5.5 (commit ecfbad74d93962fc8ca485d93****, built 2026-08-13), VS Code base 1.107.0, Electron 39.2.3
  • macOS 27.0.1 (26A434), Apple M5 Max (Mac17,14), 128 GB RAM. The machine never ran short of memory. The crash is the 4 GiB per-process heap limit (v8.getHeapStatistics().heap_size_limit = 4.00 GiB).
  • Multi-root workspace with 10 folders. Several are monorepos that keep git worktrees inside the repo (<repo>/.worktrees/<branch>/), each with its own node_modules. Worktrees are created and removed frequently by automated tooling.
  • No custom files.watcherExclude at the time of the crashes (defaults only).

Crash evidence

All 7 Crashpad minidumps (~/Library/Application Support/Antigravity IDE/Crashpad/pending/) carry ptype=browser, electron.v8-oom.is_heap_oom, and one of these:

Crash time (AEST) electron.v8-oom.location Watcher storms that session Last storm before crash
2026-09-27 20:09:18 Reached heap limit 246 3 min before
2026-10-05 11:36:58 Reached heap limit 116 5 min before
2026-10-05 17:41:28 Reached heap limit 267 1 min before
2026-10-06 07:19:18 Ineffective mark-compacts near heap limit 230 28 min before
2026-10-06 12:59:19 Reached heap limit 445 25 min before
2026-10-06 19:51:58 Ineffective mark-compacts near heap limit 335 1 min before
2026-10-08 10:06:34 Ineffective mark-compacts near heap limit 190 18 s before

“Storm” means this line in window1/fileWatcher.log:

[warning] [File Watcher ('parcel')] started ignoring events due to too many file change events at once (incoming: 6855, most recent change: <repo>/.worktrees/<branch>/frontend/support-app/node_modules/...)

These are usually interleaved with:

[error] [File Watcher ('parcel')] Events were dropped by the FSEvents client. File system must be re-scanned. (path: <repo>)

Each session survives hundreds of storms before it crashes. That fits memory being retained a little on every storm, or on every re-scan, rather than one storm being fatal on its own. The most recent crash came 18 seconds after a sustained burst: 4,000–7,000 incoming events every 500 ms from 10:05:54 to 10:06:16, while a worktree’s node_modules was being deleted. For scale: after the restart, the fresh main process was already at about 414 MB RSS five minutes after launch.

Separately, the language server does not back off when the network fails. It reports its errors through the main process (“LS Main stderr”). During two overnight ISP outages (26 Sep 20:10 to 27 Sep 06:59, and planned ISP maintenance on 7 Oct 00:13 to 03:59), it logged about 11,000 dial tcp: lookup *.googleapis.com: no such host errors in under four hours, peaking at about 1,400 an hour. That covers OAuth token refresh, play.googleapis.com/log and userinfo. Retrying at a fixed rate like this is the behaviour described in Antigravity memory grows to 11-12 GB on macOS. It is not what triggers these crashes: only 2 of the 7 crashed sessions included an outage, and in those the crash came 13–30 hours after DNS recovered.

The main log shows nothing unusual before the crash. The only renderer-side signal is Renderer reported VERY LONG TASK (86–270ms) profiling sessions in rendererPerf.log.

Steps to reproduce (expected)

  1. Open a workspace folder containing a sizeable Node project (tens of thousands of files in node_modules), with default files.watcherExclude.
  2. Repeatedly do rm -rf node_modules && npm ci, or create and remove a git worktree inside the workspace that contains a node_modules.
  3. Watch the main process (Antigravity IDE / Electron, not a Helper) grow over time. It eventually aborts with a V8 OOM, and a new .dmp appears in Crashpad/pending.

Workaround

Excluding the churn from the watcher in the workspace settings:

"files.watcherExclude": {
  "**/.git/objects/**": true,
  "**/.git/subtree-cache/**": true,
  "**/.hg/store/**": true,
  "**/.worktrees/**": true,
  "**/node_modules/**": true,
  "**/dist/**": true,
  "**/coverage/**": true
}

Applied 2026-10-08; I’ll update this thread with whether the crashes stop.

Asks

  1. Can someone confirm whether the main process retains anything per watcher event or per FSEvents re-scan? The language-server stderr piped through “LS Main” is the other main-process consumer I could see.
  2. Could **/node_modules/** be added to the default files.watcherExclude?
  3. I can share the minidumps privately (not publicly, since they may contain process memory). The Crashpad report IDs are available on request.

This is an exceptionally thorough diagnosis, Rob. Having the Crashpad minidumps, V8 heap limits, and @parcel/watcher telemetry correlated against exact timestamps makes the failure mode clear.

Regarding your first ask on whether the main process retains memory per watcher event or FSEvents re-scan: yes, it does, via IPC event queue saturation and V8 old-generation promotion.

1. The Root Cause: IPC Backpressure & V8 Old Space Promotion

In the Electron architecture underpinning Antigravity 2.5.5 (VS Code 1.107.0 / Electron 39.2.3), @parcel/watcher runs in a dedicated file-watcher worker. When macOS FSEvents drops events during high-throughput file deletions (rm -rf or worktree teardown), the kernel forces a full directory re-scan:

[error] [File Watcher ('parcel')] Events were dropped by the FSEvents client. File system must be re-scanned.

When this occurs:

  1. Event Deserialisation Storm: The watcher emits tens of thousands of synthetic file change events across IPC to the Electron main process.
  2. IPC Message Queue Backlog: The main process acts as the message broker, fanning out these events to renderer windows and piping path notifications down to the Language Server (language_server.exe / LS).
  3. Premature Old-Space Promotion: Because the main process event loop is continuously flooded with microtasks during a sustained 4,000-7,000 events/500ms burst, V8 defers full Mark-Sweep/Compact GC cycles to avoid freezing the UI. Short-lived V8 object wrappers, URI strings, and IPC buffers survive multiple minor Scavenge passes and get prematurely promoted into V8’s old pointer space.
  4. Ineffective Mark-Compacts: Once in old space, memory can only be reclaimed through major GC cycles. Your minidump signature (Ineffective mark-compacts near heap limit) is the textbook indicator: V8 attempts emergency GC passes, fails to reclaim sufficient contiguous memory before the next batch of deserialised IPC envelopes arrives, and aborts at the hard 4.00 GiB ceiling (v8.getHeapStatistics().heap_size_limit).

2. Why Internal Worktrees Multiply the Storm

Keeping git worktrees inside the watched workspace (/.worktrees/**) dramatically compounds the issue. Upstream defaults in VS Code use **/node_modules/*/** (a partial shallow pattern intended to detect top-level package changes while ignoring deep churn). However, when an entire worktree is created or removed, this wildcard fails to prevent the watcher from attempting to register and unregister thousands of atomic filesystem descriptors recursively.

3. What We Implemented Across Our Workspaces

We encountered identical file-watcher I/O thrashing and memory growth across large multi-root repositories with heavy dependency trees and build outputs.

We permanently eliminated the issue by deploying a 3-tier exclusion strategy directly into our global User settings rather than per-workspace configs:

{
  "files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/.worktrees/**": true,
    "**/node_modules/**": true,
    "**/dist/**": true,
    "**/build/**": true,
    "**/coverage/**": true,
    "**/bin/**": true,
    "**/obj/**": true,
    "**/.vs/**": true,
    "**/__pycache__/**": true,
    "**/*.pyc": true,
    "**/.venv/**": true
  },
  "search.exclude": {
    "**/.git": true,
    "**/.worktrees": true,
    "**/node_modules": true,
    "**/dist": true,
    "**/build": true,
    "**/coverage": true,
    "**/bin": true,
    "**/obj": true,
    "**/.vs": true,
    "**/__pycache__": true,
    "**/.venv": true
  },
  "files.exclude": {
    "**/.git": true,
    "**/.vs": true,
    "**/.DS_Store": true,
    "**/Thumbs.db": true
  }
}

Key Differences & Why It Works

Layer Configuration Operational Mechanism
Watcher Layer Greedy **/node_modules/** & **/.worktrees/** Replaces the shallow upstream wildcard */**. Silences @parcel/watcher at the kernel boundary so FSEvents never buffers churn during package installs or worktree deletions.
Search Layer search.exclude parity Prevents background ripgrep indexing threads from crawling through massive build trees and competing for I/O handles.
User vs Workspace Scope Global settings.json Applying this at the user level (~/Library/Application Support/Antigravity IDE/User/settings.json) ensures any newly created worktree or newly opened repo is protected before the watcher can attach.

Language servers, TypeScript compilers, and bundlers still resolve package definitions from disk without issue - they read dependencies via direct filesystem resolution, which does not require active kernel watcher handles on every single .js file inside node_modules.

Diagnostic Follow-up

If you apply **/node_modules/** and **/.worktrees/** globally in your User settings.json and restart the IDE, do you see the main process RSS stabilise at the initial ~400-500 MB baseline during your automated worktree cleanup runs, or are there still lingering leaks on your setup?

Update: root cause found. It’s a known VS Code bug, fixed upstream in 1.138; Antigravity 2.5.5 (base 1.107) doesn’t have the fix.

I took a heap snapshot of the main process (kill -USR1 to start the inspector, then HeapProfiler.takeHeapSnapshot). This was about two hours after launch, with the files.watcherExclude change already in place and no watcher floods since:

  • JS heap used: 684 MB
  • 634 MB of that (93%) is strings: 69,819 chunks of raw integrated-terminal output (ANSI full-screen redraws from tmux and TUI apps running in the terminal).
  • Every one of them has the same retainer chain:
string  <- Object.event  <- Array[n]  <- Context.j  <- closure  <- Emitter._listeners  <- PtyHostService._onProcessData

In out/main.js, j is the queue inside Event.buffer (let j=M.slice(),Q=O(re=>{j?j.push(re):z.fire(re)})). ProxyChannel.fromService wraps every service event in it, and the main process registers the pty host service that way:

const J=cl.fromService(t.get(nSr),i);r.registerChannel(wie.LocalPty,J);

On desktop the renderer talks to the pty host over a direct MessagePort, so nothing ever subscribes to onProcessData on this channel. The buffer is never flushed and keeps every byte of terminal output until the heap reaches 4 GiB.

This is exactly microsoft/vscode #234393, fixed by PR #323980 (“Fix main process OOM from unconsumed buffered pty host service events”, merged 2026-09-14, milestone 1.138.0). The fix adds createLocalPtyChannel() (src/vs/platform/terminal/common/localPtyChannel.ts), which lists the process events as unbufferedEvents. It is a small, self-contained change and should cherry-pick cleanly onto the Antigravity fork.

Correction to my original post: the file-watcher floods were a coincidence, not the cause. They happened during the same busy periods as the heavy terminal output: agents running npm ci in worktrees while their sessions redraw. The watcher exclusions are still worth having, but they don’t stop this leak. Memory kept growing at about 250 MB/h after the floods stopped.

Ask: please pick up microsoft/vscode#323980 in the next Antigravity release. Until then, any user who keeps tmux or a TUI app in the integrated terminal will hit this.

Hi @robtihanyi,

Welcome to the Forum,

Thank you for this excellent investigation, and for following up with the corrected root cause. The heap snapshot and retainer chain make this very clear.

I have shared your analysis and the reference to the upstream PR (microsoft/vscode#323980) with the internal engineering team so they can evaluate it for a future Antigravity IDE update. Please keep an eye on the changelog for any updates.

In the meantime, the following workarounds should help avoid the crash:

  • Run tmux and full-screen TUI apps in an external terminal (e.g., Terminal.app or iTerm2) instead of the integrated terminal, since that output is what builds up in the main process.
  • Restart Antigravity IDE periodically during long sessions with heavy terminal output, so memory is released before it reaches the limit.
  • Keep the files.watcherExclude settings in place. As you noted, they don’t fix this leak, but they reduce watcher load during worktree and node_modules churn.

Thanks again for the detailed report!