microsoft / microsoft/vscode

Renderer and extension host OOM when running multiple concurrent Copilot chat/agent sessions (Windows)

Open
#332,725 1 comment 0 reactions 1 assignee Claimed by @justschen View on GitHub
chat
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Type: Bug

- VS Code Version: 1.135.0 (x64)
- OS Version: Windows 11, 10.0.26200
- Machine: 16 logical CPUs, 64 GB RAM
- Feature: agent mode + Copilot CLI chat sessions (`copilotcli` agent provider)
- Does this issue occur when all extensions are disabled?: Not verified — the repro requires Copilot Chat.

### Describe the bug

Running **two or more concurrent Copilot chat/agent sessions** (multiple windows, agent mode, long
transcripts with many rendered code blocks) reliably drives the renderer process to an
out-of-memory kill within a couple of hours. The machine has 64 GB RAM with >20 GB free at the time
of the crash, so this is a **per-process V8/renderer heap exhaustion, not system memory pressure**.

Two distinct crash signatures occur, often in the same session:

1. **Extension host** — `crashed with code -36861` (`exited with code: 4294930435`, i.e. `0xFFFF7003`),
reported by Electron as `reason: 'crashed'`.
2. **Renderer** — `renderer process gone (reason: oom, code: -536870904)` (`0xE0000008`, PartitionAlloc
`kOomExceptionCode`).

Once the renderer starts OOM-ing it enters a crash loop — three OOM kills in 70 seconds — and the
window has to be closed.

### Steps to Reproduce

1. Open 2+ VS Code windows, each with an active Copilot agent-mode chat session.
2. Drive long agent conversations that render many markdown code blocks and use editing/tool calls.
3. Leave the sessions open and keep interacting for ~1–2 hours.
4. Observe escalating `potential listener LEAK detected` errors in the renderer log, followed by
`renderer process gone (reason: oom, ...)`.

### Crash timeline

Excerpt from `main.log` across several sessions (PIDs redacted):

```
2026-08-23 12:57:28.636 [info] Extension host with pid exited with code: 4294930435, signal: unknown.
2026-08-23 12:57:28.640 [error] [UtilityProcess id: 4, type: extensionHost, pid: ]: crashed with code -36861 and reason 'crashed'
2026-08-25 12:28:35.539 [error] CodeWindow: renderer process gone (reason: crashed, code: -36861)
2026-08-26 09:42:03.153 [error] CodeWindow: renderer process gone (reason: crashed, code: -36861)
2026-08-26 12:15:01.259 [error] CodeWindow: renderer process gone (reason: oom, code: -536870904)
2026-08-26 13:17:38.679 [error] ptyHost terminated unexpectedly with code 4294930435
2026-08-26 14:14:02.368 [info] Extension host with pid exited with code: 4294930435, signal: unknown.
2026-08-26 14:14:02.369 [error] [UtilityProcess id: 3, type: extensionHost, pid: ]: crashed with code -36861 and reason 'crashed'
2026-08-26 14:34:14.132 [error] CodeWindow: detected unresponsive
2026-08-26 15:25:34.541 [warning] No ptyHost heartbeat after 6 seconds
2026-08-26 15:25:38.795 [error] CodeWindow: renderer process gone (reason: crashed, code: -36861)
2026-08-26 15:26:56.602 [error] CodeWindow: renderer process gone (reason: oom, code: -536870904)
2026-08-26 15:27:30.298 [error] CodeWindow: renderer process gone (reason: oom, code: -536870904)
2026-08-26 15:28:05.884 [error] CodeWindow: renderer process gone (reason: oom, code: -536870904)
2026-08-26 15:28:06.789 [error] [UtilityProcessWorker]: terminated unexpectedly with code 3221226505, signal: unknown
```

Preceding the crash, the extension host repeatedly goes unresponsive:

```
[info] Extension host (LocalProcess pid: ) is unresponsive.
[info] UNRESPONSIVE extension host: starting to profile NOW
[info] Extension host (LocalProcess pid: ) is responsive.
```

### Leak evidence — chat code-block editor pool

`renderer.log` shows `potential listener LEAK detected` growing steadily, and the count scales with
the number/duration of concurrent chat sessions. Counts of leak warnings per window log:

```
3, 6, 8, 13, 13, 14, 16, 16, 16, 25, 37, 39, 39, 47, 67, 149, 218
```

The heaviest windows (149, 218) are the ones that went on to OOM.

**Leak stack 1 — chat code block renderer / editor pool:**

```
[error] potential listener LEAK detected, popular: Error
at s.create (workbench.desktop.main.js:431:18494)
at _Tt._event (workbench.desktop.main.js:433:2398)
at new HE (workbench.desktop.main.js:2760:31045)
at s._createInstance (workbench.desktop.main.js:2098:2000)
at s.createInstance (workbench.desktop.main.js:2098:1440)
at CCe._pool._register.Rti.maxIdleSize [as _itemFactory] (workbench.desktop.main.js:2872:11122)
at Rti.get (workbench.desktop.main.js:2727:52291)
at CCe.get (workbench.desktop.main.js:2872:11257)
at xw.renderCodeBlock (workbench.desktop.main.js:2871:4543)
at Object.codeBlockRendererSync (workbench.desktop.main.js:2871:1632)
at o.codeBlockRendererSync.t.code (workbench.desktop.main.js:822:2688)
at s.parse (workbench.desktop.main.js:817:1812)
at i6.parse (workbench.desktop.main.js:818:5470)
at not.render (workbench.desktop.main.js:937:207936)
at v5.render (workbench.desktop.main.js:2723:44)
at new xw (workbench.desktop.main.js:2871:3169)
```

**Leak stack 2 — chat editing modified-file entries leaking `onDidChangeFilesAssociation`:**

```
[error] potential listener LEAK detected, popular: Error
at s.create (workbench.desktop.main.js:431:18494)
at qL._event [as onDidChangeFilesAssociation] (workbench.desktop.main.js:433:2398)
at lV.registerListeners (workbench.desktop.main.js:1980:12895)
at new lV (workbench.desktop.main.js:1980:12556)
at s._createInstance (workbench.desktop.main.js:2098:2000)
at NYe.doResolve (workbench.desktop.main.js:5392:8693)
at Wht.doCreateReferencedObject (workbench.desktop.main.js:1980:28085)
at Wht.acquire (workbench.desktop.main.js:431:3513)
at PTe.acquire (workbench.desktop.main.js:431:3832)
at Bht.createModelReference (workbench.desktop.main.js:1980:30381)
at mJ._createModifiedFileEntry (workbench.desktop.main.js:3475:38300)
at mJ._getOrCreateModifiedFileEntry (workbench.desktop.main.js:3475:37372)
at mJ._initEntries (workbench.desktop.main.js:3475:35210)
at async mJ._init (workbench.desktop.main.js:3475:24485)
```

Both stacks point at chat surfaces creating text-model references / editor instances per rendered
item and registering listeners that outlive the chat turn. With N concurrent sessions the growth is
roughly N× per unit time, which matches the observed correlation between session count and
time-to-OOM.

### Analysis

- `-536870904` = `0xE0000008` = `partition_alloc::win::kOomExceptionCode` — the renderer really did
exhaust its heap.
- `-36861` = `0xFFFF7003` — V8/Node heap exhaustion on a different termination path, so Electron
labels it `reason: 'crashed'` rather than `'oom'`.
- Free system RAM at crash time was ~22 GB of 64 GB, and commit had ~49 GB free, so this is not
system-wide memory pressure.

### Related issues

- microsoft/vscode#265548 — Copilot + very large file → `-36861` (open)
- microsoft/vscode#303526 — renderer repeatedly crashes with `reason: oom, code: -536870904` during
heavy workspace + chat sessions (open)
- microsoft/vscode#170407 — extension conflict → `-36861` (open)
- microsoft/vscode#332408 — **merged**, fixes extension host OOM when listing Copilot CLI sessions by
throttling concurrent session deserialization (milestone 1.136.0). This likely addresses the
*extension host* half of this report but not the *renderer* OOM.

### Notes on attachments

No Crashpad minidump is attached: `~/.vscode/argv.json` had `"enable-crash-reporter": false` and
`telemetry.telemetryLevel` was `"off"`, so no dump was produced for these crashes. The crash reporter
has now been enabled and a minidump will be attached once the crash reproduces.

Windows Error Reporting did record earlier `Code.exe` faults on this machine:

- `EventType=BEX64`, `Exception Code=c0000409` (STATUS_STACK_BUFFER_OVERRUN / fastfail),
fault module `Code.exe`, app version 1.130.0.0
- `EventType=AppHangB1`, `Hang Signature a67e`, app versions 1.130.0.0 / 1.131.0.0

All logs above have been redacted of usernames, machine names, file paths, workspace names, chat
content and session identifiers.

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.