microsoft / microsoft/vscode

Copilot Chat leaks the window renderer to OOM (-536870904) on idle Remote-SSH; disabling Copilot Chat is a confirmed fix (1.127.0)

Open
#324,809 4 comments 0 reactions 1 assignee Claimed by @deepak1556 View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Type: **Bug**

## Summary

On **VS Code 1.127.0** with **Remote-SSH** (Windows client → Linux host), the **local window renderer crashes with `The window terminated unexpectedly (reason: 'oom', code: '-536870904')`** on a metronomic ~4-minute cycle, with little or no user interaction (it happens even when only image files are "open"). I traced the driver to the **GitHub Copilot Chat machinery / bundled `@github/copilot` SDK**: the corresponding **remote extension host leaks 0.6–1.2 GB/min autonomously — with zero clients attached and no files open** — and **disabling GitHub Copilot Chat stops the crashes completely** (before/after monitor below). Same crash signature and cure as the closed #11997 and open #313762 / #303387 / #312318, now with the leak quantified and the culprit isolated.

## Environment

- **VS Code:** 1.127.0, commit `4fe60c8b1cdac1c4c174f2fb180d0d758272d713`, 2026-06-30 (same build client + remote server)
- **Client:** Windows x64 (the `0xE0000008` exception form is Windows-specific)
- **Remote:** Linux x64, shared multi-core host over NFS home, accessed via Remote-SSH
- **Workspace:** multi-root (several folders on the remote)
- **Relevant extensions:** GitHub Copilot Chat, Claude Code (`Anthropic.claude-code`), Pylance/Python, rainbow-csv
- **Crash code:** `-536870904` = `0xE0000008` (Chromium `base::TerminateBecauseOutOfMemory`, per-process allocation failure — not system-wide OOM; the remote node has ~3 TB RAM, ~2.9 TB free throughout)

## Steps to Reproduce

1. From a Windows laptop, connect to a remote Linux host via Remote-SSH and open a (multi-root) workspace.
2. Leave GitHub Copilot Chat enabled (a chat-session view is restored on each window — here the Claude Code chat session, activation event `onChatSession:claude-code`).
3. Leave the window largely idle (no heavy files needed — reproduced with only small images open, and even with **no** editors open).
4. The window renderer memory climbs and the window dies with `reason: 'oom', code: '-536870904'` after ~3–6 minutes; VS Code offers to reopen, restoring the same chat view → the loop repeats.

## Observed Behavior — the leak, measured

The **remote extension host** for each window grows monotonically and keeps growing **after its window has already died and with zero clients attached**:

| Extension host | Age / state | RSS |
|---|---|---|
| PID A (window already dead, 0 clients, no files) | 13:24 | 9,870 MB |
| — | 13:25 | 11,467 MB |
| — | 13:26:59 | 12,932 MB (~92% CPU, 396 threads) |
| — | disposed at 5-min grace expiry (exit 0, **not** OOM) | ~12.2 GB |
| PID B (replacement, fresh window) | age 266 s | 2,838 MB — same trajectory |

Rate ≈ **0.6–1.2 GB/min**. Window lifetimes were metronomic: 8 non-graceful client losses at 3.3–6.4 min each. The remote node never runs low on RAM; the identical machinery mirrored in the **local ~4 GB renderer** reaches its ceiling in ~4 min, matching every observed window lifetime. (Consistent with #303387's maintainer note that "the leak is in the window process, not the extension host.")

### Leak fingerprint

- The **only non-core native module mapped** in the leaking host is the bundled Copilot SDK runtime:
`…/server/extensions/copilot/node_modules/@github/copilot/sdk/prebuilds/linux-x64/runtime.node`
- **384 `tokio-rt-worker` threads** (= host `nproc`) spawned by that runtime, at ~92% CPU.
- A recurring **timer-driven error** fires ~2× per session in `copilot/dist/extension.js`:
`Error: e is not iterable at …setItems (…) … sk.init … Timeout._onTimeout` — a retry loop consistent with the fixed cadence.
- `/proc//io`: `rchar` +200 MB/25 s (cached/socket churn), `read_bytes` only +100 KB/25 s → in-memory growth, not disk I/O.

## The fix / decisive test

**Disabling GitHub Copilot Chat eliminates the crash.** An 18-minute monitor (45 s sampling) after disabling it:

| | Before disable | After disable |
|---|---|---|
| New window's extension host | climbing 7.2 → 9.2 GB (~0.7 GB/min) until grace-disposed | **FLAT: ~340 / ~530 MB, Δ ≈ +1 MB over 17 min** |
| Window crashes in the window | every ~4 min | **0 in 18 min (~4.5 would-be cycles)** |

This matches the independently-reported cure in the closed #11997 ("When I disable the Copilot extension on the Windows desktop, I no longer have any issue").

## Expected Behavior

An idle Remote-SSH window with Copilot Chat enabled (and a restored chat-session view) should not leak the window renderer to its per-process ceiling. Extension-host memory should not grow unbounded with no client attached and no files open.

## Key Observations

- **Content-independent:** crashes recur at the same cadence regardless of open files (reproduced with only small images, and with no editors); image decode is ruled out (open images decoded to ~49 MB total, ~1.2% of the ceiling; one crash preceded the first image's creation).
- **Webviews run locally under Remote-SSH** (per the Remote Extensions docs: "the Webview API is always run on the user's local machine"), so a leaking chat-session webview lands in the local renderer even though the workspace is remote.
- **`@github/copilot` SDK is now bundled in VS Code core** (`server/extensions/copilot/…`), so this affects stock 1.127.0, not just the marketplace Copilot Chat extension.
- Known-ineffective mitigations from the related reports: adding RAM (#313762 crashed with 48 GB free), `--max-memory` (#175792, cannot raise past 4096), `--disable-gpu` (#226484, null result).

## Related issues

- #313762 — near-identical: idle Remote-SSH (Windows → Linux) renderer OOM `-536870904`, onset ~1.116/1.117, still open on 1.127; that reporter also runs `claude-code` + `rainbow-csv`.
- #303387 — Copilot Chat inflates the **window process** 366 MB → 20+ GB to the identical `-536870904`; maintainer: "the leak is in the window process, not the extension host".
- #312318 — same signature, `info-needed`.
- Closed corroboration: microsoft/vscode-copilot-release#11997 and #4219 (`freeze-slow-crash-leak`) — same code, same "disable Copilot fixes it".

## Logs

```
[ManagementConnection] The reconnection short grace time of 5m has expired, so the connection will be disposed.
[ExtensionHostConnection] Extension Host Process exited with code: 0, signal: null.
[error] Error: e is not iterable
at .setItems (…/server/extensions/copilot/dist/extension.js:1162:19963)
… sk.init … Timeout._onTimeout
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.