fix: stop unbounded websocket inflate-byte recording#293819
Merged
alexdima merged 2 commits intomicrosoft:mainfrom Feb 11, 2026
Merged
fix: stop unbounded websocket inflate-byte recording#293819alexdima merged 2 commits intomicrosoft:mainfrom
alexdima merged 2 commits intomicrosoft:mainfrom
Conversation
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @bpaseroMatched files:
|
Contributor
Author
|
@microsoft-github-policy-service agree |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a runtime switch to stop recording “inflate seed” bytes for WebSocket permessage-deflate once they’re no longer needed, preventing unbounded memory growth in long-lived server-side WebSocket scenarios (notably management/tunnel connections and post-handoff to the extension host process).
Changes:
- Introduces
setRecordInflateBytes(record: boolean)onWebSocketNodeSocket,WebSocketFlowManager, andZlibInflateStream, clearing previously recorded bytes when disabled. - Disables inflate-byte recording for server-side management and tunnel connections, and after capturing the seed bytes used for extension-host socket handoff.
- Improves zlib stream cleanup by clearing internal buffers and closing zlib streams during disposal.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/vs/server/node/remoteExtensionHostAgentServer.ts | Disables inflate-byte recording for management and tunnel WebSocket connections to prevent long-lived accumulation. |
| src/vs/server/node/extensionHostConnection.ts | Disables recording after capturing seed bytes for socket handoff; also disables recording when socket passing isn’t possible. |
| src/vs/base/parts/ipc/node/ipc.net.ts | Adds the toggle API through the WebSocket stack and strengthens zlib stream disposal to clear buffers/close streams. |
3c12ed4 to
fe3849d
Compare
Contributor
Author
|
Hi, @alexdima. all review feedback is addressed and CI is green. Would you mind taking a look when you have a moment? Thanks. |
TylerLeonhardt
approved these changes
Feb 11, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request adds the ability to dynamically enable or disable recording of inflated bytes in WebSocket communication, and ensures that this recording is properly disabled and cleaned up in key server-side scenarios. The main changes include introducing a new method for toggling this recording, propagating this control through the relevant classes, and improving resource cleanup during disposal.
I hit an unbounded memory growth issue in code-server (up to ~90GB RSS in 2 days) that appears to match the behavior described in #234806, and this PR includes a fix.
Dynamic inflate byte recording control:
setRecordInflateBytes(record: boolean)method toWebSocketNodeSocket,WebSocketFlowManager, andZlibInflateStreamto allow toggling the recording of inflated bytes at runtime. When disabled, any previously recorded bytes are cleared.Resource cleanup improvements:
dispose()methods of bothZlibInflateStreamandZlibDeflateStreamto clear internal buffers and safely close zlib streams, guarding against errors during disposal.