vscode-remote-release
vscode-remote-release copied to clipboard
[Remote-SSH Bug]: Impossible to connect to same host twice
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.useLocalServer
setting
Connect Locally
It connects successfully
->
No response
Expected Behavior
No response
Steps To Reproduce
- With VS Code 1.89.1, when I want to connect to a Windows Server 2022 with Open SSH Server
- The first time, the connection is OK but when I close my VS Code windows and I want to open a new one in order to reconnect to the same host
- Vs Code try to connect many times and fails
- I have the following error CodeError(CommandFailed { command: "bash", code: -1, output: "program not found" }): Error: CodeError(CommandFailed { command: "bash", code: -1, output: "program not found" })
Remote-SSH Log
Remote-SSH Log
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\Users\casdenpleskuser>
PS C:\Users\casdenpleskuser> $uuid="918398a5d762"
PS C:\Users\casdenpleskuser> "${uuid}: running"
918398a5d762: running
PS C:\Users\casdenpleskuser> "918398a5d762: pauseLog"
918398a5d762: pauseLog
PS C:\Users\casdenpleskuser> $ProgressPreference='SilentlyContinue'
PS C:\Users\casdenpleskuser> $r_='dc96b837cf6bb4af9cd736aa3af08cf8279f7685'
PS C:\Users\casdenpleskuser> $p=$env:PROCESSOR_ARCHITECTURE
PS C:\Users\casdenpleskuser> $arch=if (($p -eq 'AMD64') -or ($p -eq 'IA64')) { 'x64' } else { 'ia32' }
PS C:\Users\casdenpleskuser>
PS C:\Users\casdenpleskuser> $s_=(Join-Path (Resolve-Path ~) '.vscode-server')
PS C:\Users\casdenpleskuser> $cliDataDir=(Join-Path "$s_" 'cli')
PS C:\Users\casdenpleskuser> $env:VSCODE_AGENT_FOLDER=$s_
PS C:\Users\casdenpleskuser> $log=New-TemporaryFile
PS C:\Users\casdenpleskuser> $c_="code"
PS C:\Users\casdenpleskuser> $d_="$c_.exe"
PS C:\Users\casdenpleskuser> $e_="$c_-$r_.exe"
PS C:\Users\casdenpleskuser> $f_="$s_\$e_"
PS C:\Users\casdenpleskuser> $t_='stable'
PS C:\Users\casdenpleskuser> $k_=$True
PS C:\Users\casdenpleskuser> $l_=$False
PS C:\Users\casdenpleskuser> $global:v_ = $False
PS C:\Users\casdenpleskuser> $global:w_ = ''
PS C:\Users\casdenpleskuser> $global:n_ = ''
PS C:\Users\casdenpleskuser> $global:o_ = ''
PS C:\Users\casdenpleskuser> $global:p_ = ''
PS C:\Users\casdenpleskuser> $global:q_ = ''
PS C:\Users\casdenpleskuser> function ak_ {
>> "listeningOn==$port=="
>> "osReleaseId==windows=="
>> "osVersion==$ai_=="
>> "arch==$arch=="
>> "platform==windows=="
>> "unpackResult==$w_=="
>> "didLocalDownload==$v_=="
>> "downloadTime==$n_=="
>> "installTime==$o_=="
>> "extInstallTime==$p_=="
>> "serverStartTime==$q_=="
>> "execServerToken==4083c86f-1c10-4db8-96bd-00b27b73f5e1=="
>> }
>>
PS C:\Users\casdenpleskuser> function m_ {
>> return [system.diagnostics.stopwatch]::StartNew();
>> }
>>
PS C:\Users\casdenpleskuser> function q($code) {
>> "${uuid}: start"
>> "exitCode==$code=="
>> ak_
>> "${uuid}: end"
>> }
>>
PS C:\Users\casdenpleskuser> function a_ {
>> $x_=$PID
>> while ($True) {
>> $y_=(gcim win32_process | ? processid -eq $x_).parentprocessid
>> if (!$y_) {
>> "no sshd parent proc"
>> exit 0
>> }
>>
>> if ((gps -Id $y_).Name -eq 'sshd') {
>> return $y_
>> }
>>
>> $x_=$y_
>> }
>>
>> }
>>
PS C:\Users\casdenpleskuser> function b_ {
>> if ($launchedCli1Pid) {
>> if (!(gps -Id $z_)) {
>> "server died, exit"
>> exit 0
>> }
>>
>> } else {
>> if (!(gps -Id $sshdPID)) {
>> "sshd parent died, exit"
>> exit 0
>> }
>>
>> }
>>
>> }
>>
PS C:\Users\casdenpleskuser> function GetArtifactName {
>> $aa_=if ($arch -eq 'x64') { "-$arch" } else { "" }
>>
>> "cli-win32$aa_"
>> }
>>
PS C:\Users\casdenpleskuser> function g_ {
>> $s=m_
>> "Downloading cli $arch"
>> "${uuid}%%1%%"
>> $an=GetArtifactName
>> $splat=@{
>> Uri="https://update.code.visualstudio.com/commit:$r_/$an/$t_"
>> TimeoutSec=20
>> OutFile="vscode-cli-$r_.zip"
>> UseBasicParsing=$True
>> }
>>
>> [Net.ServicePointManager]::SecurityProtocol = 'Tls12'
>> irm @splat
>> $s.Stop()
>> $global:n_ = $s.ElapsedMilliseconds
>> }
>>
PS C:\Users\casdenpleskuser> function h_ {
>> $global:w_='success'
>> $s=m_
>> try {
>> $ac_=[System.IO.Path]::GetRandomFileName()
>> $ad_="$env:TEMP\$ac_"
>> "Expanding cli into $ad_"
>> "${uuid}%%2%%"
>> Expand-Archive "vscode-cli-$r_.zip" -DestinationPath "$ad_"
>> cp "$ad_\$d_" -Destination $f_
>> del -Recurse $ad_
>> del "vscode-cli-$r_.zip"
>> $s.Stop()
>> $global:o_ = $s.ElapsedMilliseconds
>> } catch {
>> $global:w_='error'
>> "Failed to unzip cli. - $($_.ToString())"
>> j_ 37
>> h_
>> }
>>
>> if(!(Test-Path "$f_")) {
>> $global:w_='missingFiles'
>> "Downloaded server is incomplete."
>> j_ 37
>> h_
>> }
>>
>> }
>>
PS C:\Users\casdenpleskuser> function aj_ {
>> $s=m_
>> if(Test-Path $log) {
>> del $log
>> }
>>
>> $escapedCliFile=$f_ -replace ' ', '` '
>> $args="command-shell --cli-data-dir '$cliDataDir' --parent-process-id $sshdPID --on-port --require-token 4083c86f-1c10-4db8-96bd-00b27b73f5e1 *> '$log'"
>> $splat=@{
>> FilePath = "powershell.exe"
>> WindowStyle = "hidden"
>> ArgumentList = @(
>> "-ExecutionPolicy", "Unrestricted", "-NoLogo", "-NoProfile", "-NonInteractive", "-c", "$escapedCliFile $args"
>> )
>> PassThru = $True
>> }
>>
>> "Starting cli: & '$f_' $args"
>> $global:z_ = (start @splat).ID
>> $s.Stop()
>> $global:q_ = $s.ElapsedMilliseconds
>> }
>>
PS C:\Users\casdenpleskuser> function i_ {
>> $global:v_=$True
>> "Trigger local server download"
>> $an=GetArtifactName
>> "${uuid}:trigger_server_download"
>> "artifact==$an=="
>> "destFolder==$s_=="
>> "destFolder2==/vscode-cli-$r_.zip=="
>> "${uuid}:trigger_server_download_end"
>> "Waiting for client to transfer server archive..."
>> "Waiting for $s_\vscode-cli-$r_.zip.done and vscode-cli-$r_.zip to exist"
>> while($True) {
>> if(Test-Path "$s_\vscode-cli-$r_.zip.done") {
>> if(!(Test-Path "$s_\vscode-cli-$r_.zip")) {
>> "Transfer failed"
>> q 31
>> }
>>
>> "Transfer complete"
>> del $s_\vscode-cli-$r_.zip.done
>> break
>> } else {
>> Start-Sleep -Seconds 3
>> b_
>> }
>>
>> }
>>
>> }
>>
PS C:\Users\casdenpleskuser> function j_($code) {
>> if ($v_) {
>> "Already attempted local download, failing"
>> q $code
>> } elseif($k_) {
>> i_
>> } else {
>> q $code
>> }
>>
>> }
>>
PS C:\Users\casdenpleskuser> function printResult() {
>> "${uuid}: start"
>> "SSH_AUTH_SOCK==$env:SSH_AUTH_SOCK=="
>> ak_
>> "${uuid}: end"
>> }
>>
PS C:\Users\casdenpleskuser> function main() {
>> $global:sshdPID = a_
>> if(!(Test-Path $s_)) {
>> $m="Could not create CLI directory"
>> try {
>> $null=ni -it d $s_ -f -ea si
>> } catch {
>> "$m. - $($_.ToString())"
>> return
>> }
>>
>> if(!(Test-Path $s_)) {
>> "$m"
>> return
>> }
>>
>> }
>>
>> cd $s_
>> try {
>> "Looking for existing CLI in $s_"
>> if(Test-Path "$f_") {
>> "Found installed CLI"
>> } else {
>> if ($l_) {
>> i_
>> } else {
>> try { g_ } catch {
>> "Download failed. - $($_.ToString())"
>> j_ 25
>> }
>>
>> }
>>
>> h_
>> }
>>
>> aj_
>> $ag_=@{
>> Path = $log
>> Pattern = "Listening on 127.0.0.1:(.+)"
>> }
>>
>> $af_=(Get-Date).AddSeconds(4)
>> $al_="Server did not start successfully. Full server log at $log >>>"
>> while ((Get-Date) -lt $af_) {
>> if(Test-Path $log) {
>> $ah_=(sls @ag_).Matches.Groups
>> if($ah_) {
>> $global:port = $ah_[1].Value
>> break
>> }
>>
>> }
>>
>> sleep -Milliseconds 30
>> }
>>
>> if (!$port) {
>> $al_
>> cat $log
>> "<<< End of server log"
>> q 32
>> }
>>
>> } catch {
>> "Server failed to start. - $($_.ToString())"
>> "$($_.ScriptStackTrace)"
>> }
>>
>> try {
>> $global:ai_ = (gcim Win32_OperatingSystem).Version
>> } catch {
>> "Failed to find Windows version - $($_.ToString())"
>> $global:ai_ = "unknown"
>> }
>>
>> printResult
>> "$pid, watching $sshdPID"
>> while ($True) {
>> b_
>> sleep 30
>> }
>>
>> }
>>
PS C:\Users\casdenpleskuser> "918398a5d762: resumeLog"
918398a5d762: resumeLog
PS C:\Users\casdenpleskuser> main
Looking for existing CLI in C:\Users\casdenpleskuser\.vscode-server
Found installed CLI
Starting cli: & 'C:\Users\casdenpleskuser\.vscode-server\code-dc96b837cf6bb4af9cd736aa3af08cf8279f7685.exe' command-shell --cli-data-dir 'C:\Users\casdenpleskuser\.vscode-server\cli' --parent-process-id 8712 --on-port --require-token 4083c86f-1c10-4db8-96bd-00b27b73f5e1 *> 'C:\Users\casdenpleskuser\AppData\Local\Temp\tmpC023.tmp'
918398a5d762: start
SSH_AUTH_SOCK====
listeningOn==54264==
osReleaseId==windows==
osVersion==10.0.17763==
arch==x64==
platform==windows==
unpackResult====
didLocalDownload==False==
downloadTime====
installTime====
extInstallTime====
serverStartTime==33==
execServerToken==4083c86f-1c10-4db8-96bd-00b27b73f5e1==
918398a5d762: end
14884, watching 8712
Anything else?
No response