Skip to content

The VS Code Server with Remote SSH extension or Code Server experiences a memory leak #234806

@YuhongZeng

Description

@YuhongZeng

Does this issue occur when all extensions are disabled?: No

  • VS Code Version: In VSCode with Remote SSH extension , Or Code Server
  • OS Version: Connecting Windows to the Linux Server

Phenomenon
The VS Code Server with Remote SSH extension or Code Server experiences a memory leak issue

private readonly _recordedInflateBytes: VSBuffer[] = [];

The length of the array '_recordedInflateBytes' only grows over time and is not released unless the entry process is closed.

The snapshot information is as follows:

Image
Image
Image

 PersistentProtocol  <- src\vs\base\parts\ipc\common\ipc.net.ts
  _socket: WebSocketNodeSocket -> 
    _flowManager:WebSocketFlowManager ->
      _zlibInflateStream: ZlibInflateStream ->
        _recordedInflateBytes: VSBuffer[] -> The length of the array only grows with time  (65411 items in heapsnap shot)

Steps to Reproduce:

  1. In VSCode version 1.94.2 with Remote SSH extension ,

  2. disable the 'Use Exec server' option to switch the VSCode server to a WebSocket connection type to reproduce the issue.

  3. Wait for one week and check the entry process.

  4. Code Server.

  5. Wait for one week and check the entry process.

Thought:

The recording of inflated bytes results in a memory leak. The Recording inflated bytes is not necessary if the socket will not be sent to ExtensionHost process. The solution is to disable sending the socket to the ExtensionHost process and as a result, the need to write inflated bytes is eliminated. A named pipe can be used to communicate with the ExtensionHost instead of sending a socket.

this._canSendSocket = (!isWindows || !this._environmentService.args['socket-path']);

the “_canSendSocket” property is always true for non-Windows platforms. The named pipe is only used on Windows. Are there any problems or concerns?

Metadata

Metadata

Assignees

Labels

author-verification-requestedIssues potentially verifiable by issue authorbugIssue identified by VS Code Team member as probable bugfreeze-slow-crash-leakVS Code crashing, performance, freeze and memory leak issuesperfremoteRemote system operations issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions