microsoft / microsoft/vscode-remote-release

Failed to parse remote port (most of the time)

Open
#10,980 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug ssh
Dominant language
Dockerfile
Stars
4.2k
Forks
470
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.useLocalServer setting
  • 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

[14:53:27.398] Log Level: 2
[14:53:27.403] VS Code version: 1.100.2
[14:53:27.403] Remote-SSH version: remote-ssh@0.120.0
[14:53:27.403] win32 x64
[14:53:27.404] SSH Resolver called for "ssh-remote+example.com", attempt 1
[14:53:27.406] remote.SSH.useLocalServer = false
[14:53:27.406] remote.SSH.useExecServer = true
[14:53:27.407] remote.SSH.bindHost = {}
[14:53:27.407] remote.SSH.showLoginTerminal = false
[14:53:27.407] remote.SSH.remotePlatform = {…}
[14:53:27.407] remote.SSH.path = undefined
[14:53:27.407] remote.SSH.configFile = undefined
[14:53:27.407] remote.SSH.useFlock = false
[14:53:27.407] remote.SSH.lockfilesInTmp = false
[14:53:27.407] remote.SSH.localServerDownload = auto
[14:53:27.407] remote.SSH.remoteServerListenOnSocket = false
[14:53:27.407] remote.SSH.defaultExtensions = []
[14:53:27.408] remote.SSH.defaultExtensionsIfInstalledLocally = []
[14:53:27.408] remote.SSH.loglevel = 2
[14:53:27.408] remote.SSH.enableDynamicForwarding = true
[14:53:27.408] remote.SSH.enableRemoteCommand = false
[14:53:27.408] remote.SSH.serverPickPortsFromRange = {}
[14:53:27.408] remote.SSH.serverInstallPath = {}
[14:53:27.408] remote.SSH.permitPtyAllocation = false
[14:53:27.408] remote.SSH.preferredLocalPortRange = undefined
[14:53:27.410] remote.SSH.useCurlAndWgetConfigurationFiles = false
[14:53:27.410] remote.SSH.experimental.chat = false
[14:53:27.410] remote.SSH.experimental.enhancedSessionLogs = false
[14:53:27.410] remote.SSH.httpProxy = {}
[14:53:27.410] remote.SSH.httpsProxy = {}
[14:53:27.419] SSH Resolver called for host: example.com
[14:53:27.419] Setting up SSH remote "example.com"
[14:53:27.428] Using commit id "848b80aeb52026648a8ff9f7c45a9b0a80641e2e" and quality "stable" for server
[14:53:27.428] Extensions to install: 
[14:53:27.433] Install and start server if needed
[14:53:27.439] Checking ssh with "C:\ProgramData\scoop\apps\python\current\Scripts\ssh.exe -V"
[14:53:27.442] Got error from ssh: spawn C:\ProgramData\scoop\apps\python\current\Scripts\ssh.exe ENOENT
[14:53:27.442] Checking ssh with "C:\ProgramData\scoop\apps\python\current\ssh.exe -V"
[14:53:27.443] Got error from ssh: spawn C:\ProgramData\scoop\apps\python\current\ssh.exe ENOENT
[14:53:27.443] Checking ssh with "C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler\ssh.exe -V"
[14:53:27.444] Got error from ssh: spawn C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler\ssh.exe ENOENT
[14:53:27.444] Checking ssh with "C:\ProgramData\scoop\shims\ssh.exe -V"
[14:53:27.488] > OpenSSH_9.9p1, OpenSSL 3.2.3 3 Sep 2024

[14:53:27.493] Running script with connection command: "C:\ProgramData\scoop\shims\ssh.exe" -T -D 60811 "example.com" sh
[14:53:27.494] Generated SSH command: 'type "…\AppData\Local\Temp\vscode-linux-multi-line-command-example.com-356461369.sh" | "C:\ProgramData\scoop\shims\ssh.exe" -T -D 60811 "example.com" sh'
[14:53:27.495] Using connect timeout of 17 seconds
[14:53:27.496] Terminal shell path: C:\Windows\System32\cmd.exe
[14:53:30.234] > 
[14:53:30.234] Got some output, clearing connection timeout
[14:53:30.263] > Enter passphrase for key '…/.ssh/id_ed25519': 
[14:53:30.264] Detected passphrase message
[14:53:33.265] Got passphrase response
[14:53:33.265] "install" wrote data to terminal: "…"
[14:53:33.279] > 
[14:53:34.539] > 188b0b88652c: running
> Script executing under PID: 10541
[14:53:34.571] > Found existing installation at …/.vscode-server...
> Starting VS Code CLI...
> Removing old logfile at …/.vscode-server/.cli.848b80aeb52026648a8ff
> 9f7c45a9b0a80641e2e.log
> Spawned remote CLI: 10786
[14:53:34.586] > Waiting for server log...
[14:53:34.603] > Waiting for server log...
[14:53:34.651] > Waiting for server log...
[14:53:34.683] > Waiting for server log...
[14:53:34.715] > Waiting for server log...
[14:53:34.763] > Waiting for server log...
[14:53:34.794] > Waiting for server log...
[14:53:34.825] > Waiting for server log...
[14:53:34.873] > Waiting for server log...
[14:53:34.904] > Waiting for server log...
[14:53:34.951] > Waiting for server log...
[14:53:34.983] > Waiting for server log...
[14:53:35.014] > Waiting for server log...
[14:53:35.061] > Waiting for server log...
[14:53:35.107] > Waiting for server log...
[14:53:35.139] > 188b0b88652c: start  
> listeningOn====      
> osReleaseId==debian==
> arch==x86_64==       
> vscodeArch==x64==    
> bitness==64==        
> tmpDir==/tmp==       
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> serverStartTime==576==
> execServerToken==1a1a1111-a1a1-1aa1-aaa1-1111a11aa111==
> platformDownloadPath==cli-alpine-x64==
> SSH_AUTH_SOCK====
> DISPLAY====
> 188b0b88652c: end
[14:53:35.139] Received install output:   
listeningOn====      
osReleaseId==debian==
arch==x86_64==       
vscodeArch==x64==    
bitness==64==        
tmpDir==/tmp==       
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
serverStartTime==576==
execServerToken==1a1a1111-a1a1-1aa1-aaa1-1111a11aa111==
platformDownloadPath==cli-alpine-x64==
SSH_AUTH_SOCK====
DISPLAY====

[14:53:35.140] Failed to parse remote port from server output
[14:53:35.141] Resolver error: Error: 
	at y.Create (…\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:744751)
	at t.handleInstallOutput (…\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:742832)
	at t.tryInstall (…\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:865534)
	at async …\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:824246
	at async t.withShowDetailsEvent (…\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:827501)
	at async A (…\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:820760)
	at async t.resolve (…\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:824898)
	at async …\.vscode\extensions\ms-vscode-remote.remote-ssh-0.120.0\out\extension.js:2:1113660
[14:53:35.143] ------

Expected Behavior

On a specific server I have another case of "Failed to parse remote port". Judging from the logs it looks like vscode remote is trying to wait for the server log file but then seemingly does not receive anything. However, on the remote machine, I can see a logfile called

~/.vscode-server/.cli.848b80aeb52026648a8ff9f7c45a9b0a80641e2e.log

which was created while connecting. Its contents are

Listening on 127.0.0.1:38655

The weird thing is that sometimes it works. Sometimes I have to retry 20 times and then it works. May be it's not waiting long enough for the log file?

I also checked the access rights for the ~/.vscode-server directory and the log file itself - and everything is as it should be.

Actual Behavior

Connection cannot be established due to "Failed to parse remote port from server output".

Steps To Reproduce

I have no real reproduction, as this only happens for one specific environment - and not always.

Anything else?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Remote-SSH log and the remote ~/.vscode-server/.cli.848b80aeb52026648a8ff9f7c45a9b0a80641e2e.log, comparing the empty listeningOn output with the log's Listening on 127.0.0.1:38655 line. Reproduce the intermittent connection failure in the reported environment and determine whether successful connections consistently parse the remote port.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.