Skip to content

fix: restore 8 KiB Node buffer pool on linux - #326334

Merged
Martin Aeschlimann (aeschli) merged 1 commit into
release/1.129from
robo/restore_node_buffer_pool_linux_1_129
Jul 17, 2026
Merged

Martin Aeschlimann (aeschli) merged 1 commit into
release/1.129from
robo/restore_node_buffer_pool_linux_1_129

Conversation

@deepak1556

Copy link
Copy Markdown
Collaborator

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

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;
- Mojo buffering messages with missing handles;
- subsequent resource failures and service-worker Cache.put() 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 original stale-FD reassociation and 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.
Node's default pool size.
@deepak1556 Robo (deepak1556) added this to the 1.129.1 milestone Jul 17, 2026
@deepak1556 Robo (deepak1556) self-assigned this Jul 17, 2026
Copilot AI review requested due to automatic review settings July 17, 2026 12:10
@deepak1556 Robo (deepak1556) added the candidate Issue identified as probable candidate for fixing in the next release 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.

Pull request overview

Mitigates Linux renderer file-descriptor exhaustion caused by Node 24.18’s enlarged buffer pool.

Changes:

  • Restores the Linux Node buffer pool size to 8 KiB during bootstrap.
Show a summary per file
File Description
src/bootstrap-node.ts Configures an 8 KiB buffer pool on Linux.

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment thread src/bootstrap-node.ts Resolved
@deepak1556
Robo (deepak1556) force-pushed the robo/restore_node_buffer_pool_linux_1_129 branch from d64ae54 to ca65b70 Compare July 17, 2026 12:45
@deepak1556
Robo (deepak1556) marked this pull request as ready for review July 17, 2026 15:31
@aeschli
Martin Aeschlimann (aeschli) merged commit 8a7abeb into release/1.129 Jul 17, 2026
74 checks passed
@aeschli
Martin Aeschlimann (aeschli) deleted the robo/restore_node_buffer_pool_linux_1_129 branch July 17, 2026 15:35
@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

candidate Issue identified as probable candidate for fixing in the next release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants