microsoft / microsoft/vscode-remote-release
Remote-SSH disconnects after a few seconds when connected over VPN
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?
When I run the SSH command directly from the terminal, it connects successfully and remains connected without issues. The problem only occurs within VS Code when using the Remote - SSH extension.
Expected Behavior
After initiating a remote SSH connection from VS Code, the connection should remain stable, allowing me to interact with the remote system without interruption.
Actual Behavior
VS Code initially connects via SSH, but after a few seconds, the connection drops. I receive a popup message:
"Failed to set up dynamic port forwarding connection over SSH to the VS Code Server."
There’s also a prompt to Reload Window, and the cycle repeats.
Steps To Reproduce
- Connect to a VPN.
- Open VS Code and initiate a Remote - SSH session to a known good host.
- Wait a few seconds — the connection drops and the above error message appears.
- Reloading causes the same issue in a loop.
Remote-SSH Log
Remote-SSH Log
[00:52:48.971] Log Level: 2
[00:52:49.210] SSH Resolver called for "ssh-remote+132.68.39.200", attempt 1
[00:52:49.268] remote.SSH.useLocalServer = false
[00:52:49.271] remote.SSH.useExecServer = false
[00:52:49.273] remote.SSH.bindHost = {}
[00:52:49.274] remote.SSH.showLoginTerminal = false
[00:52:49.288] remote.SSH.remotePlatform = {"csl3.cs.technion.ac.il":"linux","192.168.91.128":"linux","192.168.91.129":"linux","csComp.cs.technion.ac.il":"linux","132.68.39.200":"linux"}
[00:52:49.290] remote.SSH.path = C:\WINDOWS\System32\OpenSSH\ssh.exe
[00:52:49.291] remote.SSH.configFile = C:\Users\fahou\.ssh\config
[00:52:49.293] remote.SSH.useFlock = true
[00:52:49.299] remote.SSH.lockfilesInTmp = false
[00:52:49.302] remote.SSH.localServerDownload = auto
[00:52:49.304] remote.SSH.remoteServerListenOnSocket = false
[00:52:49.306] remote.SSH.defaultExtensions = []
[00:52:49.308] remote.SSH.defaultExtensionsIfInstalledLocally = []
[00:52:49.315] remote.SSH.loglevel = 2
[00:52:49.317] remote.SSH.enableDynamicForwarding = true
[00:52:49.320] remote.SSH.enableRemoteCommand = false
[00:52:49.322] remote.SSH.serverPickPortsFromRange = {}
[00:52:49.323] remote.SSH.serverInstallPath = {}
[00:52:49.325] remote.SSH.permitPtyAllocation = true
[00:52:49.328] remote.SSH.preferredLocalPortRange = undefined
[00:52:49.331] remote.SSH.useCurlAndWgetConfigurationFiles = false
[00:52:49.334] remote.SSH.experimental.chat = true
[00:52:49.335] remote.SSH.experimental.enhancedSessionLogs = true
[00:52:49.337] remote.SSH.httpProxy = {"*":""}
[00:52:49.338] remote.SSH.httpsProxy = {"*":""}
[00:52:49.408] VS Code version: 1.100.0
[00:52:49.410] Remote-SSH version: remote-ssh@0.121.2025050915
[00:52:49.412] win32 x64
[00:52:49.435] SSH Resolver called for host: 132.68.39.200
[00:52:49.435] Setting up SSH remote "132.68.39.200"
[00:52:49.492] Using commit id "19e0f9e681ecb8e5c09d8784acaa601316ca4571" and quality "stable" for server
[00:52:49.492] Extensions to install:
[00:52:49.548] Install and start server if needed
[00:52:49.576] Checking ssh with "C:\WINDOWS\System32\OpenSSH\ssh.exe -V"
[00:52:49.797] > OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
[00:52:49.828] Using SSH config file "C:\Users\fahou\.ssh\config"
[00:52:49.830] Running script with connection command: "C:\WINDOWS\System32\OpenSSH\ssh.exe" -D 55040 -F "C:\Users\fahou\.ssh\config" "132.68.39.200" bash
[00:52:49.838] Generated SSH command: 'type "C:\Users\fahou\AppData\Local\Temp\vscode-linux-multi-line-command-132.68.39.200-330531858.sh" | "C:\WINDOWS\System32\OpenSSH\ssh.exe" -D 55040 -F "C:\Users\fahou\.ssh\config" "132.68.39.200" bash'
[00:52:49.842] Using connect timeout of 152 seconds
[00:52:49.849] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[00:52:50.860] >
[00:52:50.861] Got some output, clearing connection timeout
[00:52:52.814] > 2e5aadfed335: running
[00:52:52.839] > Acquiring lock on /home/fahoumfa/.vscode-server/bin/19e0f9e681ecb8e5c09d8784acaa601316ca4571/vscode-remote-lock.fahoumfa.19e0f9e681ecb8e5c09d8784acaa601316ca4571
[00:52:52.853] > Found existing installation at /home/fahoumfa/.vscode-server/bin/19e0f9e681ecb8e5c09d8784acaa601316ca4571...
[00:52:52.868] > Checking /home/fahoumfa/.vscode-server/.19e0f9e681ecb8e5c09d8784acaa601316ca4571.log and /home/fahoumfa/.vscode-server/.19e0f9e681ecb8e5c09d8784acaa601316ca4571.pid for a running server
> Looking for server with pid: 1113454
[00:52:52.949] > Starting VS Code Server... "/home/fahoumfa/.vscode-server/bin/19e0f9e681ecb8e5c09d8784acaa601316ca4571/bin/code-server" --start-server --server-data-dir "/home/fahoumfa/.vscode-server" --host=127.0.0.1 --accept-server-license-terms --enable-remote-auto-shutdown --port=0 --telemetry-level all &> "/home/fahoumfa/.vscode-server/.19e0f9e681ecb8e5c09d8784acaa601316ca4571.log" < /dev/null
> The VS Code Server log file is /home/fahoumfa/.vscode-server/.19e0f9e681ecb8e5c09d8784acaa601316ca4571.log
[00:52:52.979] > Removing old logfile at /home/fahoumfa/.vscode-server/.19e0f9e681ecb8e5c09d8784acaa601316ca4571.log
> Spawned remote server: 1141821
> Waiting for server log...
[00:52:53.010] > Waiting for server log...
[00:52:53.044] > Waiting for server log...
[00:52:53.089] > Waiting for server log...
[00:52:53.121] >
> *
> * Visual Studio Code Server
> *
> * By using the software, you agree to
> * the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-lice
> ense) and
> * the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacyst
> tatement).
> *
>
[00:52:53.137] > 2e5aadfed335: start
[00:52:53.150] >
[00:52:53.184] > SSH_AUTH_SOCK====
> DISPLAY====
> webUiAccessToken====
> listeningOn==40995==
> osReleaseId==ubuntu==
> arch==x86_64==
> vscodeArch==x64==
> bitness==64==
> tmpDir==/run/user/243319797==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> extInstallTime====
> serverStartTime==171==
> connectionToken==11aaa1aa-a11a-1111-a1aa-11a11aa1a111==
> 2e5aadfed335: end
[00:52:53.184] Received install output:
SSH_AUTH_SOCK====
DISPLAY====
webUiAccessToken====
listeningOn==40995==
osReleaseId==ubuntu==
arch==x86_64==
vscodeArch==x64==
bitness==64==
tmpDir==/run/user/243319797==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime==171==
connectionToken==11aaa1aa-a11a-1111-a1aa-11a11aa1a111==
[00:52:53.186] Remote server is listening on port 40995
[00:52:53.187] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":40995},"osReleaseId":"ubuntu","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/243319797","platform":"linux","connectionToken":"11aaa1aa-a11a-1111-a1aa-11a11aa1a111"},"serverStartTime":171,"installUnpackCode":""}
[00:52:53.201] Starting forwarding server. local port 55042 -> socksPort 55040 -> remotePort 40995
[00:52:53.205] Forwarding server listening on port 55042
[00:52:53.205] Waiting for ssh tunnel to be ready
[00:52:53.211] [Forwarding server port 55042] Got connection 0
[00:52:53.218] Tunneled port 40995 to local port 55042
[00:52:53.218] Resolved "ssh-remote+132.68.39.200" to "port 55042"
[00:52:53.254] ------
[00:52:53.256] No hints found in the recent session.
[00:52:53.292] [Forwarding server port 55042] Got connection 1
[00:52:53.454] [Forwarding server port 55042] Got connection 2
[00:53:04.561] ------
[00:53:04.562] SSH Resolver called for "ssh-remote+132.68.39.200", attempt 2, (Reconnection)
[00:53:04.566] [Forwarding server port 55042] Got connection 3
[00:53:04.575] SSH Resolver called for host: 132.68.39.200
[00:53:04.575] Setting up SSH remote "132.68.39.200"
[00:53:04.583] Using commit id "19e0f9e681ecb8e5c09d8784acaa601316ca4571" and quality "stable" for server
[00:53:04.583] Extensions to install:
[00:53:04.604] Install and start server if needed
[00:53:04.624] Using SSH config file "C:\Users\fahou\.ssh\config"
[00:53:04.627] Running script with connection command: "C:\WINDOWS\System32\OpenSSH\ssh.exe" -D 55057 -F "C:\Users\fahou\.ssh\config" "132.68.39.200" bash
[00:53:04.632] Generated SSH command: 'type "C:\Users\fahou\AppData\Local\Temp\vscode-linux-multi-line-command-132.68.39.200-561059208.sh" | "C:\WINDOWS\System32\OpenSSH\ssh.exe" -D 55057 -F "C:\Users\fahou\.ssh\config" "132.68.39.200" bash'
[00:53:04.633] Using connect timeout of 152 seconds
[00:53:04.634] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[00:53:04.645] Failed to set up socket for dynamic port forward to remote port 40995: Socket closed. TCP port forwarding may be disabled, or the remote server may have crashed. See the VS Code Server log above for details.
[00:53:04.683] > channel 5: open failed: connect failed: Connection refused
[00:53:05.286] >
[00:53:05.286] Got some output, clearing connection timeout
[00:53:07.082] > bd88dcf546fb: running
[00:53:07.097] > Acquiring lock on /home/fahoumfa/.vscode-server/bin/19e0f9e681ecb8e5c09d8784acaa601316ca4571/vscode-remote-lock.fahoumfa.19e0f9e681ecb8e5c09d8784acaa601316ca4571
[00:53:07.112] > Found existing installation at /home/fahoumfa/.vscode-server/bin/19e0f9e681ecb8e5c09d8784acaa601316ca4571...
[00:53:07.128] > Checking /home/fahoumfa/.vscode-server/.19e0f9e681ecb8e5c09d8784acaa601316ca4571.log and /home/fahoumfa/.vscode-server/.19e0f9e681ecb8e5c09d8784acaa601316ca4571.pid for a running server
> Looking for server with pid: 1141821
[00:53:07.222] > Starting VS Code Server... "/home/fahoumfa/.vscode-server/bin/19e0f9e681ecb8e5c09d8784acaa601316ca4571/bin/code-server" --start-server --server-data-dir "/home/fahoumfa/.vscode-server" --host=127.0.0.1 --accept-server-license-terms --enable-remote-auto-shutdown --port=0 --telemetry-level all &> "/home/fahoumfa/.vscode-server/.19e0f9e681ecb8e5c09d8784acaa601316ca4571.log" < /dev/null
> The VS Code Server log file is /home/fahoumfa/.vscode-server/.19e0f9e681ecb8e5c09d8784acaa601316ca4571.log
[00:53:07.237] > Removing old logfile at /home/fahoumfa/.vscode-server/.19e0f9e681ecb8e5c09d8784acaa601316ca4571.log
[00:53:07.253] > Spawned remote server: 1142739
> Waiting for server log...
[00:53:07.284] > Waiting for server log...
[00:53:07.316] > Waiting for server log...
[00:53:07.364] > Waiting for server log...
[00:53:07.395] > Waiting for server log...
[00:53:07.428] >
> *
> * Visual Studio Code Server
> *
> * By using the software, you agree to
> * the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-lice
> ense) and
> * the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacyst
> tatement).
> *
>
[00:53:07.460] > bd88dcf546fb: start
> SSH_AUTH_SOCK====
> DISPLAY====
> webUiAccessToken====
> listeningOn==42547==
> osReleaseId==ubuntu==
> arch==x86_64==
> vscodeArch==x64==
> bitness==64==
> tmpDir==/run/user/243319797==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> extInstallTime====
> serverStartTime==208==
> connectionToken==111a1a1a-11a1-111a-11a1-aaa11a11aaaa==
> bd88dcf546fb: end
[00:53:07.461] Received install output:
SSH_AUTH_SOCK====
DISPLAY====
webUiAccessToken====
listeningOn==42547==
osReleaseId==ubuntu==
arch==x86_64==
vscodeArch==x64==
bitness==64==
tmpDir==/run/user/243319797==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime==208==
connectionToken==111a1a1a-11a1-111a-11a1-aaa11a11aaaa==
[00:53:07.462] Remote server is listening on port 42547
[00:53:07.462] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":42547},"osReleaseId":"ubuntu","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/243319797","platform":"linux","connectionToken":"111a1a1a-11a1-111a-11a1-aaa11a11aaaa"},"serverStartTime":208,"installUnpackCode":""}
[00:53:07.473] Starting forwarding server. local port 55059 -> socksPort 55057 -> remotePort 42547
[00:53:07.477] Forwarding server listening on port 55059
[00:53:07.478] Waiting for ssh tunnel to be ready
[00:53:07.482] >
[00:53:07.484] [Forwarding server port 55059] Got connection 0
[00:53:07.487] Tunneled port 42547 to local port 55059
[00:53:07.488] Resolved "ssh-remote+132.68.39.200" to "port 55059"
[00:53:07.495] ------
[00:53:07.497] No hints found in the recent session.
[00:53:07.525] [Forwarding server port 55059] Got connection 1```
</p>
</details>
### Anything else?
_No response_
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 with the Remote-SSH: Show Log output and compare the generated SSH command with the successful terminal connection. Trace the dynamic port forwarding failure and the remote VS Code Server log while reproducing the disconnect over VPN. Done means a Remote-SSH session remains stable instead of looping after the forwarding connection is refused.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vscode
- Domain
- devtools, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100