microsoft / microsoft/vscode-remote-release
`EADDRINUSE` raised on local part when connecting to a remote server although the local port is not already used
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
[19:53:39.073] Log Level: 2
[19:53:39.091] SSH Resolver called for "ssh-remote+xcomx250-1", attempt 1
[19:53:39.094] remote.SSH.useLocalServer = false
[19:53:39.095] remote.SSH.useExecServer = true
[19:53:39.095] remote.SSH.bindHost = {}
[19:53:39.095] remote.SSH.showLoginTerminal = false
[19:53:39.095] remote.SSH.remotePlatform = {}
[19:53:39.095] remote.SSH.path =
[19:53:39.095] remote.SSH.configFile =
[19:53:39.095] remote.SSH.useFlock = true
[19:53:39.095] remote.SSH.lockfilesInTmp = false
[19:53:39.095] remote.SSH.localServerDownload = auto
[19:53:39.095] remote.SSH.remoteServerListenOnSocket = false
[19:53:39.095] remote.SSH.defaultExtensions = []
[19:53:39.095] remote.SSH.defaultExtensionsIfInstalledLocally = []
[19:53:39.095] remote.SSH.loglevel = 2
[19:53:39.095] remote.SSH.enableDynamicForwarding = true
[19:53:39.095] remote.SSH.enableRemoteCommand = false
[19:53:39.096] remote.SSH.serverPickPortsFromRange = {}
[19:53:39.096] remote.SSH.serverInstallPath = {"xcomx250-1":"/scratch/felmarty","xcomx250-2":"/scratch/felmarty","xcomx300-1":"/scratch/felmarty","xcomx300-2":"/scratch/felmarty","xcoh100-1":"/scratch/felmarty"}
[19:53:39.096] remote.SSH.permitPtyAllocation = false
[19:53:39.096] remote.SSH.preferredLocalPortRange = undefined
[19:53:39.096] remote.SSH.useCurlAndWgetConfigurationFiles = false
[19:53:39.096] remote.SSH.experimental.chat = true
[19:53:39.096] remote.SSH.experimental.enhancedSessionLogs = true
[19:53:39.096] remote.SSH.httpProxy = {"*":""}
[19:53:39.096] remote.SSH.httpsProxy = {"*":""}
[19:53:39.104] VS Code version: 1.98.2
[19:53:39.104] Remote-SSH version: remote-ssh@0.119.0
[19:53:39.104] win32 x64
[19:53:39.108] SSH Resolver called for host: xcomx250-1
[19:53:39.109] Setting up SSH remote "xcomx250-1"
[19:53:39.127] Using commit id "ddc367ed5c8936efe395cffeec279b04ffd7db78" and quality "stable" for server
[19:53:39.127] Extensions to install:
[19:53:39.131] Install and start server if needed
[19:53:42.022] Checking ssh with "C:\Users\felmarty\AppData\Local\miniconda3\ssh.exe -V"
[19:53:42.027] Got error from ssh: spawn C:\Users\felmarty\AppData\Local\miniconda3\ssh.exe ENOENT
[19:53:42.027] Checking ssh with "C:\Users\felmarty\AppData\Local\miniconda3\Library\mingw-w64\bin\ssh.exe -V"
[19:53:42.031] Got error from ssh: spawn C:\Users\felmarty\AppData\Local\miniconda3\Library\mingw-w64\bin\ssh.exe ENOENT
[19:53:42.031] Checking ssh with "C:\Users\felmarty\AppData\Local\miniconda3\Library\usr\bin\ssh.exe -V"
[19:53:42.035] Got error from ssh: spawn C:\Users\felmarty\AppData\Local\miniconda3\Library\usr\bin\ssh.exe ENOENT
[19:53:42.035] Checking ssh with "C:\Users\felmarty\AppData\Local\miniconda3\Library\bin\ssh.exe -V"
[19:53:42.039] Got error from ssh: spawn C:\Users\felmarty\AppData\Local\miniconda3\Library\bin\ssh.exe ENOENT
[19:53:42.039] Checking ssh with "C:\Users\felmarty\AppData\Local\miniconda3\Scripts\ssh.exe -V"
[19:53:42.043] Got error from ssh: spawn C:\Users\felmarty\AppData\Local\miniconda3\Scripts\ssh.exe ENOENT
[19:53:42.044] Checking ssh with "C:\Users\felmarty\AppData\Local\miniconda3\bin\ssh.exe -V"
[19:53:42.049] Got error from ssh: spawn C:\Users\felmarty\AppData\Local\miniconda3\bin\ssh.exe ENOENT
[19:53:42.049] Checking ssh with "C:\Windows\System32\AMD\ssh.exe -V"
[19:53:42.054] Got error from ssh: spawn C:\Windows\System32\AMD\ssh.exe ENOENT
[19:53:42.054] Checking ssh with "C:\Users\felmarty\AppData\Local\miniconda3\ssh.exe -V"
[19:53:42.059] Got error from ssh: spawn C:\Users\felmarty\AppData\Local\miniconda3\ssh.exe ENOENT
[19:53:42.059] Checking ssh with "C:\Users\felmarty\AppData\Local\miniconda3\Library\mingw-w64\bin\ssh.exe -V"
[19:53:42.065] Got error from ssh: spawn C:\Users\felmarty\AppData\Local\miniconda3\Library\mingw-w64\bin\ssh.exe ENOENT
[19:53:42.065] Checking ssh with "C:\Users\felmarty\AppData\Local\miniconda3\Library\usr\bin\ssh.exe -V"
[19:53:42.070] Got error from ssh: spawn C:\Users\felmarty\AppData\Local\miniconda3\Library\usr\bin\ssh.exe ENOENT
[19:53:42.070] Checking ssh with "C:\Users\felmarty\AppData\Local\miniconda3\Library\bin\ssh.exe -V"
[19:53:42.075] Got error from ssh: spawn C:\Users\felmarty\AppData\Local\miniconda3\Library\bin\ssh.exe ENOENT
[19:53:42.075] Checking ssh with "C:\Users\felmarty\AppData\Local\miniconda3\Scripts\ssh.exe -V"
[19:53:42.081] Got error from ssh: spawn C:\Users\felmarty\AppData\Local\miniconda3\Scripts\ssh.exe ENOENT
[19:53:42.081] Checking ssh with "C:\Users\felmarty\AppData\Local\miniconda3\bin\ssh.exe -V"
[19:53:42.088] Got error from ssh: spawn C:\Users\felmarty\AppData\Local\miniconda3\bin\ssh.exe ENOENT
[19:53:42.088] Checking ssh with "C:\WINDOWS\system32\ssh.exe -V"
[19:53:42.094] Got error from ssh: spawn C:\WINDOWS\system32\ssh.exe ENOENT
[19:53:42.095] Checking ssh with "C:\WINDOWS\ssh.exe -V"
[19:53:42.102] Got error from ssh: spawn C:\WINDOWS\ssh.exe ENOENT
[19:53:42.103] Checking ssh with "C:\WINDOWS\System32\Wbem\ssh.exe -V"
[19:53:42.107] Got error from ssh: spawn C:\WINDOWS\System32\Wbem\ssh.exe ENOENT
[19:53:42.107] Checking ssh with "C:\WINDOWS\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[19:53:42.113] Got error from ssh: spawn C:\WINDOWS\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[19:53:42.114] Checking ssh with "C:\WINDOWS\System32\OpenSSH\ssh.exe -V"
[19:53:42.396] > OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
[19:53:42.659] Running script with connection command: "C:\WINDOWS\System32\OpenSSH\ssh.exe" -T -D 49173 "xcomx250-1" sh
[19:53:42.664] Generated SSH command: 'type "C:\Users\felmarty\AppData\Local\Temp\vscode-linux-multi-line-command-xcomx250-1-964383857.sh" | "C:\WINDOWS\System32\OpenSSH\ssh.exe" -T -D 49173 "xcomx250-1" sh'
[19:53:42.665] Using connect timeout of 17 seconds
[19:53:42.666] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[19:53:45.739] > The use of this system is restricted to authorized persons only. All others will be prosecuted to the full extent of the law.
[19:53:45.739] Got some output, clearing connection timeout
[19:53:45.758] > The use of this system is restricted to authorized persons only. All others will be prosecuted to the full extent of the law.
>
>
>
>
>
>
>
>
>
>
>
[19:53:49.818] > 45c60502096b: running
> Script executing under PID: 479839
> Found existing installation at /scratch/felmarty/.vscode-server...
> Starting VS Code CLI...
> Removing old logfile at /scratch/felmarty/.vscode-server/.cli.ddc367ed5c8936efe395cffeec279b04ffd7db78.log
> Spawned remote CLI: 479857
> Waiting for server log...
[19:53:49.858] > 45c60502096b: start
> listeningOn==127.0.0.1:45101==
> osReleaseId==ubuntu==
> arch==x86_64==
> vscodeArch==x64==
> bitness==64==
> tmpDir==/run/user/50087403==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> serverStartTime==41==
> execServerToken==a11a1a11-1111-1a1a-aa11-1a11111a11aa==
> platformDownloadPath==cli-alpine-x64==
> SSH_AUTH_SOCK====
> DISPLAY====
> 45c60502096b: end
[19:53:49.859] Received install output:
listeningOn==127.0.0.1:45101==
osReleaseId==ubuntu==
arch==x86_64==
vscodeArch==x64==
bitness==64==
tmpDir==/run/user/50087403==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
serverStartTime==41==
execServerToken==a11a1a11-1111-1a1a-aa11-1a11111a11aa==
platformDownloadPath==cli-alpine-x64==
SSH_AUTH_SOCK====
DISPLAY====
[19:53:49.860] Remote server is listening on port 45101
[19:53:49.860] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":45101},"osReleaseId":"ubuntu","arch":"x86_64","sshAuthSock":"","display":"","tmpDir":"/run/user/50087403","platform":"linux","execServerToken":"a11a1a11-1111-1a1a-aa11-1a11111a11aa"},"serverStartTime":41,"installUnpackCode":""}
[19:53:49.873] >
[19:53:49.877] Starting forwarding server. local port 49228 -> socksPort 49173 -> remotePort 45101
[19:53:49.881] Forwarding server listening on port 49228
[19:53:49.881] Waiting for ssh tunnel to be ready
[19:53:49.891] [Forwarding server port 49228] Got connection 0
[19:53:49.903] Tunneled port 45101 to local port 49228
[19:53:49.903] Resolved "ssh-remote+xcomx250-1" to "port 49228"
[19:53:49.911] Initizing new exec server for ssh-remote+xcomx250-1
[19:53:49.911] Resolving exec server at port 49228
[19:53:49.923] Exec server for ssh-remote+xcomx250-1 failed: Error: connect EADDRINUSE 127.0.0.1:49228
[19:53:49.923] Resolver error: Error: connect EADDRINUSE 127.0.0.1:49228
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1611:16)
[19:53:49.933] ------
Expected Behavior
Hi,
When trying to connect to a remote machine, I am getting EADDRINUSE on a local port, although it is not used prior to connecting to remote through VS Code.
I am not sure what the cause may be. I am able to successfully use e.g. ssh -L 127.0.0.1:50000:127.0.0.1:33549 -T myname@myserver through the Powershell/WSL command line, for example.
Actual Behavior
Above error
Steps To Reproduce
rm -rf .vscode-server/ on the remote.
settings.json:
{
"remote.SSH.serverInstallPath": {
"mymachine": "/scratch/felmarty",
},
"update.mode": "manual",
}
/mnt/c/Users/felmarty/.ssh:
Host xcomx250-1
HostName mymachine
User felmarty
IdentityFile ~/.ssh/felmary_amd
Select "Linux" remote when asked.
Then:
Then, after trying to connect and getting EADDRINUSE, the port used appears indeed to be used by code.exe:
Prior to that, the port is not used. One can e.g. set "remote.SSH.preferredLocalPortRange": "50000-50010", to verify it.
Anything else?
Tried on VS Code 1.99, 1.98, 1.97 and Remote-SSH latest to 0.116.1
This happened in sync with the update of a remote to ubuntu 24.04 but I can not really see any link with it.
The remote /etc/ssh/sshd_config does not override the default AllowTcpForwarding and AllowAgentForwarding.
Moreover,
(base) PS C:\Users\felmarty> echo "echo hello" | ssh.exe -T -D 49177 "xcomx250-1" sh
gives:
The use of this system is restricted to authorized persons only. All others will be prosecuted to the full extent of the law.
hello
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 log around “Starting forwarding server” and “Initizing new exec server,” using settings.json, the SSH host configuration, and the reported preferredLocalPortRange to reproduce the failure. Trace why the forwarding server later reports EADDRINUSE even though the port was initially free; done means the remote connection completes without that local-port error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100