microsoft / microsoft/vscode-remote-release
Memory leaks after lost connection
Nobody has claimed this yet.
- Dominant language
- Dockerfile
- Stars
- 4.2k
- Forks
- 469
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
Is there an existing issue for this bug?
- I have searched the existing open issues and found none that apply.
- If I find any issue of interest that is related or closed, I will included a link to it in this issue.
Required Troubleshooting Steps
- I have read and performed the troubleshooting steps
- I have tried both values of the
remote.SSH.useLocalServersetting - My issue was not covered in the Tips and Tricks linked from the Troubleshooting Wiki.
- I will include a complete copy of my Remote - SSH logs by running Remote-SSH: Show Log in the command palette or from View > Output in the menu bar
[Optional] Diagnose with Copilot
I did not ask the @remote-ssh participant for help
In step 2 of the troubleshooting wiki, what was the result of running the generated SSH command verbatim outside of VS Code?
I did not try step 2 of the troubleshooting steps
Remote-SSH Log
Remote-SSH Log
[PASTE LOG HERE WITHIN THE BACKTICKS TO FORMAT]
Expected Behavior
No memory leak
Actual Behavior
The process of the remote extension leaks memory when the connection to the SSH server gets lost.
I observed high memory usage when I was disconnected from the SSH server I'm using. For instance, when I have multiple vscode windows, each with a remote connection and I break the connection by turning the VPN of, I observe high memory usage of some vscode renderer processes in the macos activity monitor. I opened the dev tools of vscode went to the performance tab but I couldn't see the process causing the high memory usage. I then looked at the console window of the dev tools and saw repeated warnings about high memory usage from the remote extension with their value increasing over time:
WARN [mainThreadStorage] large extension state detected (extensionId: ms-vscode-remote.remote-ssh, global: true): 532.0126953125kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.
warn @ log.ts:450
warn @ log.ts:559
warn @ logService.ts:47
getExtensionStateRaw @ extensionStorage.ts:164
(anonymous) @ mainThreadStorage.ts:34
C @ event.ts:1202
fire @ event.ts:1233
(anonymous) @ event.ts:165
C @ event.ts:1202
D @ event.ts:1213
fire @ event.ts:1237
resume @ event.ts:1389
w @ storage.ts:501
store @ storage.ts:467
setExtensionState @ extensionStorage.ts:175
$setValue @ mainThreadStorage.ts:57
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
C @ event.ts:1202
fire @ event.ts:1233
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:383
log.ts:450 WARN [mainThreadStorage] large extension state detected (extensionId: ms-vscode-remote.remote-ssh, global: true): 582.0126953125kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.
warn @ log.ts:450
warn @ log.ts:559
warn @ logService.ts:47
getExtensionStateRaw @ extensionStorage.ts:164
(anonymous) @ mainThreadStorage.ts:34
C @ event.ts:1202
fire @ event.ts:1233
(anonymous) @ event.ts:165
C @ event.ts:1202
D @ event.ts:1213
fire @ event.ts:1237
resume @ event.ts:1389
w @ storage.ts:501
store @ storage.ts:467
setExtensionState @ extensionStorage.ts:175
$setValue @ mainThreadStorage.ts:57
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
C @ event.ts:1202
fire @ event.ts:1233
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:383
log.ts:450 WARN [mainThreadStorage] large extension state detected (extensionId: ms-vscode-remote.remote-ssh, global: true): 632.0126953125kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.
warn @ log.ts:450
warn @ log.ts:559
warn @ logService.ts:47
getExtensionStateRaw @ extensionStorage.ts:164
(anonymous) @ mainThreadStorage.ts:34
C @ event.ts:1202
fire @ event.ts:1233
(anonymous) @ event.ts:165
C @ event.ts:1202
D @ event.ts:1213
fire @ event.ts:1237
resume @ event.ts:1389
w @ storage.ts:501
store @ storage.ts:467
setExtensionState @ extensionStorage.ts:175
$setValue @ mainThreadStorage.ts:57
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
C @ event.ts:1202
fire @ event.ts:1233
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:383
log.ts:450 WARN [mainThreadStorage] large extension state detected (extensionId: ms-vscode-remote.remote-ssh, global: true): 682.0126953125kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.
warn @ log.ts:450
warn @ log.ts:559
warn @ logService.ts:47
getExtensionStateRaw @ extensionStorage.ts:164
(anonymous) @ mainThreadStorage.ts:34
C @ event.ts:1202
fire @ event.ts:1233
(anonymous) @ event.ts:165
C @ event.ts:1202
D @ event.ts:1213
fire @ event.ts:1237
resume @ event.ts:1389
w @ storage.ts:501
store @ storage.ts:467
setExtensionState @ extensionStorage.ts:175
$setValue @ mainThreadStorage.ts:57
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
C @ event.ts:1202
fire @ event.ts:1233
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:383
log.ts:450 WARN [mainThreadStorage] large extension state detected (extensionId: ms-vscode-remote.remote-ssh, global: true): 732.0126953125kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.
warn @ log.ts:450
warn @ log.ts:559
warn @ logService.ts:47
getExtensionStateRaw @ extensionStorage.ts:164
(anonymous) @ mainThreadStorage.ts:34
C @ event.ts:1202
fire @ event.ts:1233
(anonymous) @ event.ts:165
C @ event.ts:1202
D @ event.ts:1213
fire @ event.ts:1237
resume @ event.ts:1389
w @ storage.ts:501
store @ storage.ts:467
setExtensionState @ extensionStorage.ts:175
$setValue @ mainThreadStorage.ts:57
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
C @ event.ts:1202
fire @ event.ts:1233
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:383
log.ts:450 WARN [mainThreadStorage] large extension state detected (extensionId: ms-vscode-remote.remote-ssh, global: true): 782.0126953125kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.
warn @ log.ts:450
warn @ log.ts:559
warn @ logService.ts:47
getExtensionStateRaw @ extensionStorage.ts:164
(anonymous) @ mainThreadStorage.ts:34
C @ event.ts:1202
fire @ event.ts:1233
(anonymous) @ event.ts:165
C @ event.ts:1202
D @ event.ts:1213
fire @ event.ts:1237
resume @ event.ts:1389
w @ storage.ts:501
store @ storage.ts:467
setExtensionState @ extensionStorage.ts:175
$setValue @ mainThreadStorage.ts:57
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
C @ event.ts:1202
fire @ event.ts:1233
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:383
log.ts:450 WARN [mainThreadStorage] large extension state detected (extensionId: ms-vscode-remote.remote-ssh, global: true): 832.0126953125kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.
warn @ log.ts:450
warn @ log.ts:559
warn @ logService.ts:47
getExtensionStateRaw @ extensionStorage.ts:164
(anonymous) @ mainThreadStorage.ts:34
C @ event.ts:1202
fire @ event.ts:1233
(anonymous) @ event.ts:165
C @ event.ts:1202
D @ event.ts:1213
fire @ event.ts:1237
resume @ event.ts:1389
w @ storage.ts:501
store @ storage.ts:467
setExtensionState @ extensionStorage.ts:175
$setValue @ mainThreadStorage.ts:57
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
C @ event.ts:1202
fire @ event.ts:1233
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:383
log.ts:450 WARN [mainThreadStorage] large extension state detected (extensionId: ms-vscode-remote.remote-ssh, global: true): 882.0126953125kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.
warn @ log.ts:450
warn @ log.ts:559
warn @ logService.ts:47
getExtensionStateRaw @ extensionStorage.ts:164
(anonymous) @ mainThreadStorage.ts:34
C @ event.ts:1202
fire @ event.ts:1233
(anonymous) @ event.ts:165
C @ event.ts:1202
D @ event.ts:1213
fire @ event.ts:1237
resume @ event.ts:1389
w @ storage.ts:501
store @ storage.ts:467
setExtensionState @ extensionStorage.ts:175
$setValue @ mainThreadStorage.ts:57
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
C @ event.ts:1202
fire @ event.ts:1233
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:383
log.ts:450 WARN [mainThreadStorage] large extension state detected (extensionId: ms-vscode-remote.remote-ssh, global: true): 932.0126953125kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.
warn @ log.ts:450
warn @ log.ts:559
warn @ logService.ts:47
getExtensionStateRaw @ extensionStorage.ts:164
(anonymous) @ mainThreadStorage.ts:34
C @ event.ts:1202
fire @ event.ts:1233
(anonymous) @ event.ts:165
C @ event.ts:1202
D @ event.ts:1213
fire @ event.ts:1237
resume @ event.ts:1389
w @ storage.ts:501
store @ storage.ts:467
setExtensionState @ extensionStorage.ts:175
$setValue @ mainThreadStorage.ts:57
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
C @ event.ts:1202
fire @ event.ts:1233
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:383
log.ts:450 WARN [mainThreadStorage] large extension state detected (extensionId: ms-vscode-remote.remote-ssh, global: true): 982.0126953125kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.
warn @ log.ts:450
warn @ log.ts:559
warn @ logService.ts:47
getExtensionStateRaw @ extensionStorage.ts:164
(anonymous) @ mainThreadStorage.ts:34
C @ event.ts:1202
fire @ event.ts:1233
(anonymous) @ event.ts:165
C @ event.ts:1202
D @ event.ts:1213
fire @ event.ts:1237
resume @ event.ts:1389
w @ storage.ts:501
store @ storage.ts:467
setExtensionState @ extensionStorage.ts:175
$setValue @ mainThreadStorage.ts:57
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
C @ event.ts:1202
fire @ event.ts:1233
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:383
log.ts:450 WARN [mainThreadStorage] large extension state detected (extensionId: ms-vscode-remote.remote-ssh, global: true): 1032.0126953125kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.
warn @ log.ts:450
warn @ log.ts:559
warn @ logService.ts:47
getExtensionStateRaw @ extensionStorage.ts:164
(anonymous) @ mainThreadStorage.ts:34
C @ event.ts:1202
fire @ event.ts:1233
(anonymous) @ event.ts:165
C @ event.ts:1202
D @ event.ts:1213
fire @ event.ts:1237
resume @ event.ts:1389
w @ storage.ts:501
store @ storage.ts:467
setExtensionState @ extensionStorage.ts:175
$setValue @ mainThreadStorage.ts:57
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
C @ event.ts:1202
fire @ event.ts:1233
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:383
log.ts:450 WARN [mainThreadStorage] large extension state detected (extensionId: ms-vscode-remote.remote-ssh, global: true): 1082.0126953125kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.
In cases with multiple remote windows, the issue causes my entire MacBook to freeze for several mins.
Steps To Reproduce
Environment
macOS 15.7.2
vscode 1.107
remote extension: 0.122.0
Reproduce
- connect to a ssh host
- create a jupyter notebook in the remote workspace, have some code in it, and execute the code (i noticed espechially high memory usage with notebooks)
- disrupt the connection with the ssh host
- wait until the "connection lost, trying to reconnect..." prompt shows after a few minuits
- open the devtools and observe the warnings on memory usage
Anything else?
Possibly related: #11261 but I observed the leak on my local machine instead of the remote host.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the disconnect with multiple Remote-SSH windows, as described, and inspect the repeated mainThreadStorage warnings in the provided DevTools output. Trace the remote extension's extension-state growth after the SSH connection is lost; done means the state no longer grows and the renderer processes no longer cause the reported system freeze.
Written by the indexing model from the issue text.
Assessment
- Domain
- devtools, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100