Skip to content

[cherry-pick] fix: restore 8 KiB Node buffer pool on linux - #326366

Merged
Martin Aeschlimann (aeschli) merged 1 commit into
mainfrom
cherry-pick/326334
Jul 17, 2026
Merged

Martin Aeschlimann (aeschli) merged 1 commit into
mainfrom
cherry-pick/326334

Conversation

@vs-code-engineering

Copy link
Copy Markdown
Contributor

Cherry-pick of #326334 from release/1.129.

Node 24.18 changed Buffer.poolSize from 8 KiB to 64 KiB in nodejs/node@d3ef412

Node uses the pool for Buffer allocations smaller than half the pool size. As a result, allocations below 32 KiB can now be views into a shared 64 KiB backing ArrayBuffer.

VS Code's VSBuffer preserves these pooled backing stores. Webview resource streaming then forwards Uint8Array views through transferable streams without copying just the visible byte range. Structured clone consequently serializes the full 64 KiB backing store.

Chromium's mojo_base::BigBuffer has a 64 KiB inline limit. The structured-clone envelope makes these payloads just above that limit, so each message switches from inline storage to writable shared memory.

On POSIX, each writable shared-memory region carries two file descriptors: its writable descriptor and a read-only descriptor used for conversion. Under a renderer RLIMIT_NOFILE of 1024, a burst of webview resource messages therefore consumes two descriptors per chunk.

Instrumentation of VS Code loading the Codex webview showed:

  • 1,910 large CommonCloneableMessage serializations
  • the dominant payload sizes were 65,556 and 65,557 bytes
  • renderer descriptors increasing through 1021, 1022, and 1023..
  • recvmsg() returning message bytes with MSG_CTRUNC once descriptors could no longer be installed
  • subsequent resource failures and service-worker network errors.

Restoring the previous 8 KiB pool size prevents small VS Code buffers from retaining 64 KiB backing stores. Their structured-clone messages remain below BigBuffer's inline threshold and no longer require shared-memory descriptor pairs.

Instrumentation with this override removed the 65,556/65,557-byte message burst and avoided the clean renderer exit. Larger shared-memory messages can still exhaust descriptors under sufficiently heavy pressure, so this is a targeted mitigation rather than a replacement for the Mojo MSG_CTRUNC fix.

Fixes #326092

Copilot AI review requested due to automatic review settings July 17, 2026 15:36
@vs-code-engineering vs-code-engineering Bot added the cherry-pick-artifact Auto-generated cherry-pick PR label Jul 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot can't review bot-authored pull requests automatically. A user with Copilot access can request a review manually.

auto-merge was automatically disabled July 17, 2026 16:08

Pull request was closed

@aeschli
Martin Aeschlimann (aeschli) merged commit 5e21260 into main Jul 17, 2026
54 checks passed
@aeschli
Martin Aeschlimann (aeschli) deleted the cherry-pick/326334 branch July 17, 2026 16:24
@vs-code-engineering vs-code-engineering Bot added this to the 1.129.1 milestone Jul 17, 2026
@ms4275436-hash

Copy link
Copy Markdown

[email protected]

@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Aug 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cherry-pick-artifact Auto-generated cherry-pick PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VSCode crashes on Linux as soon as it starts with codex extension pane

5 participants