Repository navigation
fix: restore 8 KiB Node buffer pool on linux - #326334
Merged
Martin Aeschlimann (aeschli) merged 1 commit intoJul 17, 2026
Merged
Martin Aeschlimann (aeschli) merged 1 commit into
Martin Aeschlimann (aeschli) merged 1 commit into
Conversation
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.
Contributor
There was a problem hiding this comment.
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
Robo (deepak1556)
force-pushed
the
robo/restore_node_buffer_pool_linux_1_129
branch
from
July 17, 2026 12:45
d64ae54 to
ca65b70
Compare
Robo (deepak1556)
marked this pull request as ready for review
July 17, 2026 15:31
Martin Aeschlimann (aeschli)
approved these changes
Jul 17, 2026
Martin Aeschlimann (aeschli)
enabled auto-merge (squash)
July 17, 2026 15:34
Martin Aeschlimann (aeschli)
deleted the
robo/restore_node_buffer_pool_linux_1_129
branch
July 17, 2026 15:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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