[Remote-SSH Bug]: Connecting to remote host (or opening folders) spawns processes that use 100% CPU (that are persistent and multiply upon repetition)
Is there an existing issue for this bug?
- [X] I have searched the existing issues
Required Troubleshooting Steps
- [x] I have followed these troubleshooting steps
- [X] I have tried both values of the
remote.SSH.useLocalServersetting
Connect Locally
It connects successfully
->
I have tried this with two different RHEL servers, RHEL 9.3 and RHEL 7.9. For testing this I used VSCode version 1.85.2 (so that I was able to connect to RHEL 7.9) but this issue also occurs in the latest version (1.86). The only difference in the Remote SSH settings between the two servers is that to be able to open folders on RHEL 9.3 I need to set remote.SSH.useFlock to False. I am using htop to monitor the resource utilization. I have no extensions enabled except Remote - SSH, Remote - SSH: Editing Configuration Filed, and Remote Explorer.
Connecting to a server (for the first time after installing) works as intended. The issue starts when opening a folder - this spawns a process which constantly uses 99-100% CPU even after closing the remote connection. If I connect to the host again (without opening a folder) it spawns another process (that looks the same to me) so that there are now two processes using 100% CPU (examples below). If I open a folder (in the same window) it spawns another of these 100% CPU processes. In my testing I was able to spawn 6 100% CPU processes by opening folders (in the same window) - I stopped at 6, I assume this would continue.
As mentioned closing the remote connection doesn't stop the 100% CPU utilization. Killing the server fixes this problem but presumably corrupts the server as it needs to be reinstalled to work again.
The duplication issue is with the process tagged --type=extensionHost
This is what I mean by duplication:
And duplicating 3 times:
This is what htop looks like when connecting to a freshly installed server without opening a folder:
Expected Behavior
I expect VSCode to not constantly use 100% CPU even when I am not connected to the remote server.
Steps To Reproduce
if RHEL 9.3: remote.SSH.useFlock==False
- Remote SSH - Connect Current Window to Host (no server installed yet)
- File : Open Folder ... (spawns first 100% CPU process, tested multiple folders)
- File : Open Folder ... (spawns another process, repeat for more?)
Optional :
- Remote : Close Remote Connection (optional, process continues to use 100% CPU after connection is closed)
- Remote SSH - Connect Current Window to Host (spawns additional same process even without opening a folder)
Remote-SSH Log
Remote-SSH Log After Spawning 3 100% CPU Processes
[11:19:42.191] Log Level: 2
[11:19:42.197] VS Code version: 1.86.0
[11:19:42.197] Remote-SSH version: [email protected]
[11:19:42.197] win32 x64
[11:19:42.198] SSH Resolver called for "ssh-remote+glados.crc.nd.edu", attempt 1
[11:19:42.198] "remote.SSH.useLocalServer": false
[11:19:42.198] "remote.SSH.useExecServer": false
[11:19:42.198] "remote.SSH.showLoginTerminal": false
[11:19:42.198] "remote.SSH.remotePlatform": {"glados.crc.nd.edu":"linux","earth.crc.nd.edu":"linux"}
[11:19:42.198] "remote.SSH.path": undefined
[11:19:42.198] "remote.SSH.configFile": undefined
[11:19:42.198] "remote.SSH.useFlock": false
[11:19:42.198] "remote.SSH.lockfilesInTmp": false
[11:19:42.198] "remote.SSH.localServerDownload": auto
[11:19:42.198] "remote.SSH.remoteServerListenOnSocket": false
[11:19:42.198] "remote.SSH.showLoginTerminal": false
[11:19:42.198] "remote.SSH.defaultExtensions": []
[11:19:42.198] "remote.SSH.loglevel": 2
[11:19:42.198] "remote.SSH.enableDynamicForwarding": true
[11:19:42.198] "remote.SSH.enableRemoteCommand": false
[11:19:42.198] "remote.SSH.serverPickPortsFromRange": {}
[11:19:42.198] "remote.SSH.serverInstallPath": {}
[11:19:42.201] SSH Resolver called for host: glados.crc.nd.edu
[11:19:42.202] Setting up SSH remote "glados.crc.nd.edu"
[11:19:42.204] Using commit id "05047486b6df5eb8d44b2ecd70ea3bdf775fd937" and quality "stable" for server
[11:19:42.205] Install and start server if needed
[11:19:42.207] Checking ssh with "C:\Windows\system32\ssh.exe -V"
[11:19:42.208] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT
[11:19:42.208] Checking ssh with "C:\Windows\ssh.exe -V"
[11:19:42.209] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT
[11:19:42.209] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V"
[11:19:42.209] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT
[11:19:42.209] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[11:19:42.210] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[11:19:42.210] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[11:19:42.227] > OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
[11:19:42.229] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 54892 "glados.crc.nd.edu" bash
[11:19:42.230] Terminal shell path: C:\Windows\System32\cmd.exe
[11:19:42.598] > [email protected]'s password:]0;C:\Windows\System32\cmd.exe
[11:19:42.599] Got some output, clearing connection timeout
[11:19:42.599] Showing password prompt
[11:19:45.024] Got password response
[11:19:45.024] "install" wrote data to terminal: "********************"
[11:19:45.108] >
[11:19:46.274] > 8470796b34ca: running
[11:19:46.325] > Acquiring lock on /afs/crc.nd.edu/user/a/atownse2/.vscode-server/bin/05047486b6df5eb8d44b2ecd70ea3bdf775fd937/vscode-remote-lock.atownse2.05047486b6df5eb8d44b2ecd70ea3bdf775fd937
> \ln "/afs/crc.nd.edu/user/a/atownse2/.vscode-server/bin/05047486b6df5eb8d44b2ecd70ea3bdf775fd937/vscode-remote-lock.atownse2.05047486b6df5eb8d44b2ecd70ea3bdf775fd937.target" "/afs/crc.nd.edu/user/a/atownse2/.vscode-server/bin/05047486b6df5eb8d44b2ecd70ea3bdf775fd937/vscode-remote-lock.atownse2.05047486b6df5eb8d44b2ecd70ea3bdf775fd937"
[11:19:46.338] > Found existing installation at /afs/crc.nd.edu/user/a/atownse2/.vscode-server/bin/05047486b6df5eb8d44b2ecd70ea3bdf775fd937...
> Checking /afs/crc.nd.edu/user/a/atownse2/.vscode-server/.05047486b6df5eb8d44b2ecd70ea3bdf775fd937.log and /afs/crc.nd.edu/user/a/atownse2/.vscode-server/.05047486b6df5eb8d44b2ecd70ea3bdf775fd937.pid for a running server
[11:19:46.351] > Looking for server with pid: 3456488
[11:19:46.377] > Found running server...
>
> *
> * Visual Studio Code Server
> *
> * By using the software, you agree to
> * the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
> * the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
> *
>
[11:19:46.390] > Checking server status on port 9719 with wget
[11:19:46.398] > 8470796b34ca: start
> SSH_AUTH_SOCK====
> DISPLAY====
> webUiAccessToken====
> listeningOn==9719==
> osReleaseId==rhel==
> arch==x86_64==
> vscodeArch==x64==
> bitness==64==
> tmpDir==/run/user/238761==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> extInstallTime====
> serverStartTime====
> connectionToken==11a1a111-11aa-1111-aa11-a11111a1a1a1==
> 8470796b34ca: end
[11:19:46.398] Received install output:
SSH_AUTH_SOCK====
DISPLAY====
webUiAccessToken====
listeningOn==9719==
osReleaseId==rhel==
arch==x86_64==
vscodeArch==x64==
bitness==64==
tmpDir==/run/user/238761==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
connectionToken==11a1a111-11aa-1111-aa11-a11111a1a1a1==
[11:19:46.398] Remote server is listening on port 9719
[11:19:46.398] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":9719},"osReleaseId":"rhel","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/238761","platform":"linux","connectionToken":"11a1a111-11aa-1111-aa11-a11111a1a1a1"},"installUnpackCode":""}
[11:19:46.400] Starting forwarding server. local port 54894 -> socksPort 54892 -> remotePort 9719
[11:19:46.401] Forwarding server listening on port 54894
[11:19:46.401] Waiting for ssh tunnel to be ready
[11:19:46.402] [Forwarding server port 54894] Got connection 0
[11:19:46.403] Tunneled port 9719 to local port 54894
[11:19:46.403] Resolved "ssh-remote+glados.crc.nd.edu" to "port 54894"
[11:19:46.408] ------
[11:19:46.419] [Forwarding server port 54894] Got connection 1
[11:19:46.462] [Forwarding server port 54894] Got connection 2
[11:20:07.321] [Forwarding server port 54894] Got connection 3
[11:20:27.844] [Forwarding server port 54894] Got connection 4
[11:20:48.345] [Forwarding server port 54894] Got connection 5
[11:21:08.878] [Forwarding server port 54894] Got connection 6
[11:21:29.355] [Forwarding server port 54894] Got connection 7
Anything else?
The OS I used above is Windows 11 but I can confirm the same behavior on macOS Ventura 13.5.
This issue does not seem to be present when using Remote Tunnels instead.
This would probably be due to an extension installed on your remote using high CPU. Can you try disabling any extensions on the remote host and see if it makes a difference?
The tests shown above are all done with all extensions disabled (except Remote SSH). I tried again today and found the same behavior.
I did:
- Extensions: Disable all installed extensions
- SSH : Connect current window to host ...
- Verified that all installed extensions were disabled
- Open workspace from file ... (this worked on RHEL 9.3 with flock which did not before)
- Reload Window (to spawn more processes) I spawned 6 100% CPU processes that were shown as distinct in the tree view of htop. I killed the server and needed to uninstall it.
So that I could try on a freshly installed server I did:
- SSH : Kill VS Code server on host
- SSH : Uninstall ...
- Wait for process to finish
- SSH : Connect current window to host
- Extensions: Disable all installed extensions
- Reload Window
- Enable SSH
- Open workspace from file
- Reload (to spawn x number of process) I saw the same behavior now as I saw before with both the existing server and the one I freshly installed.
I'm having a similar issue;
- launch Code and connect Remote SSH to hosting
- web host process spawns in top (code-903b1e9d89)
- close Code, code-903b1e9d89 process doesn't stop
- re-launch Code and connect Remote SSH to hosting
- another web host process spawns in top (code-903b1e9d89)
This repeats unless I manually kill the code-903b1e9d89 PID via shell, pretty painful.
Hey @roblourens, this issue might need further attention.
@atownse2, you can help us out by closing this issue if the problem no longer exists, or adding more information.
I have been using Remote Tunnels as a way around this issue - I just tested again and it looks like the issue persists.
The tldr is that when I ssh into this machine and open a new folder (File: Open Folder) I will get a process: node --dns-result-order=ipv4first ... which consumes 100% CPU. This process persists after closing the remote connection and opening a new folder. Opening a new folder will spawn another such process and it seems like there is no upper limit to the number of persistent (100% CPU) processes I can spawn this way.
I'm happy to provide more information, however, I do not have root access on this machine.