microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.61k stars 274 forks source link

[Remote-SSH Bug]: `gnu-screen` takes forever to execute on remote server #10079

Open rusty-key opened 1 month ago

rusty-key commented 1 month ago

Is there an existing issue for this bug?

Required Troubleshooting Steps

Connect Locally

It connects successfully

->

No response

Expected Behavior

I have a rather weird issue with vscode-remote and gnu-screen: when using integrated terminal on remote server, screen takes forever to run:

$ time screen -v
Screen version 4.09.00 (GNU) 30-Jan-22

________________________________________________________
Executed in   18.86 secs    fish           external
   usr time    3.06 secs  599.00 micros    3.06 secs
   sys time   15.80 secs    0.00 micros   15.80 secs

It runs perfectly well in any other connection, including ssh connection from within the integrated terminal on remote server:

$ ssh me
<...>

$ time screen -v
Screen version 4.09.00 (GNU) 30-Jan-22

________________________________________________________
Executed in   15.09 millis    fish           external
   usr time    1.33 millis    1.33 millis    0.00 millis
   sys time   13.33 millis    0.27 millis   13.07 millis

My only guess now is it is somehow related to the environment set by vscode, as it is erased when I am connecting to myself.

I tried: — tweaking env variables to match "normal" session; — tweaking all available remote.SSH; — fresh installation of vscode with all extensions disabled.

None of these had any effect.

Also, it is worth mentioning, that it's a recent issue, everything worked with the same configuration until recently and I don't remember any changes on my server. Maybe something changed in a recent update of vscode or vscode-remote? I would be happy to hear any suggestions on how to debug this or what to try.

Steps To Reproduce

No response

Remote-SSH Log

Remote-SSH Log

``` [15:39:55.482] Log Level: 2 [15:39:55.487] VS Code version: 1.91.1 [15:39:55.487] Remote-SSH version: remote-ssh@0.112.0 [15:39:55.487] darwin arm64 [15:39:55.501] SSH Resolver called for "ssh-remote+fe", attempt 1 [15:39:55.501] "remote.SSH.useLocalServer": false [15:39:55.501] "remote.SSH.useExecServer": false [15:39:55.501] "remote.SSH.showLoginTerminal": true [15:39:55.501] "remote.SSH.remotePlatform": {"fe":"linux"} [15:39:55.501] "remote.SSH.path": undefined [15:39:55.501] "remote.SSH.configFile": /Users/rusty/.ssh/config [15:39:55.501] "remote.SSH.useFlock": false [15:39:55.501] "remote.SSH.lockfilesInTmp": false [15:39:55.501] "remote.SSH.localServerDownload": auto [15:39:55.501] "remote.SSH.remoteServerListenOnSocket": false [15:39:55.502] "remote.SSH.showLoginTerminal": true [15:39:55.502] "remote.SSH.defaultExtensions": [] [15:39:55.502] "remote.SSH.loglevel": 2 [15:39:55.502] "remote.SSH.enableDynamicForwarding": false [15:39:55.502] "remote.SSH.enableRemoteCommand": false [15:39:55.502] "remote.SSH.serverPickPortsFromRange": {} [15:39:55.503] "remote.SSH.serverInstallPath": {} [15:39:55.588] SSH Resolver called for host: fe [15:39:55.588] Setting up SSH remote "fe" [15:39:55.588] Using commit id "f1e16e1e6214d7c44d078b1f0607b2388f29d729" and quality "stable" for server [15:39:55.593] Install and start server if needed [15:39:55.698] PATH: /opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/openssl@3/bin:/usr/local/sbin:/usr/local/opt/mariadb@10.3/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/iTerm.app/Contents/Resources/utilities [15:39:55.698] Checking ssh with "ssh -V" [15:39:55.705] > OpenSSH_9.6p1, LibreSSL 3.3.6 [15:39:55.756] Using SSH config file "/Users/rusty/.ssh/config" [15:39:55.756] Running script with connection command: ssh -T -o ClearAllForwardings=true -o ConnectTimeout=15 -F '/Users/rusty/.ssh/config' fe bash [15:39:56.744] > 487d2db80e65: running [15:39:56.744] Got some output, clearing connection timeout [15:39:56.769] > Acquiring lock on /home/me/.vscode-server/bin/f1e16e1e6214d7c44d078b1f0607b2388f29d729/vscode-remote-lock.me.f1e16e1e6214d7c44d078b1f0607b2388f29d729 [15:39:56.778] > \ln "/home/me/.vscode-server/bin/f1e16e1e6214d7c44d078b1f0607b2388f29d729/vscode-remote-lock.me.f1e16e1e6214d7c44d078b1f0607b2388f29d729.target" "/home/me/.vscode-server/bin/f1e16e1e6214d7c44d078b1f0607b2388f29d729/vscode-remote-lock.me.f1e16e1e6214d7c44d078b1f0607b2388f29d729" > Found existing installation at /home/me/.vscode-server/bin/f1e16e1e6214d7c44d078b1f0607b2388f29d729... > Checking /home/me/.vscode-server/.f1e16e1e6214d7c44d078b1f0607b2388f29d729.log and /home/me/.vscode-server/.f1e16e1e6214d7c44d078b1f0607b2388f29d729.pid for a running server > Looking for server with pid: 766160 [15:39:56.796] > 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). > * > [15:39:56.803] > Checking server status on port 40217 with wget [15:39:56.815] > 487d2db80e65: start > webUiAccessToken==== > listeningOn==40217== > osReleaseId==debian== > arch==x86_64== > vscodeArch==x64== > bitness==64== > tmpDir==/run/user/2013== > platform==linux== > unpackResult==== > didLocalDownload==0== > downloadTime==== > installTime==== > extInstallTime==== > serverStartTime==== > connectionToken==a1111a1a-1a11-1a1a-aa11-1a11a111aa1a== > 487d2db80e65: end [15:39:56.815] Received install output: webUiAccessToken==== listeningOn==40217== osReleaseId==debian== arch==x86_64== vscodeArch==x64== bitness==64== tmpDir==/run/user/2013== platform==linux== unpackResult==== didLocalDownload==0== downloadTime==== installTime==== extInstallTime==== serverStartTime==== connectionToken==a1111a1a-1a11-1a1a-aa11-1a11a111aa1a== [15:39:56.815] Remote server is listening on port 40217 [15:39:56.816] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":40217},"osReleaseId":"debian","arch":"x86_64","webUiAccessToken":"","tmpDir":"/run/user/2013","platform":"linux","connectionToken":"a1111a1a-1a11-1a1a-aa11-1a11a111aa1a"},"installUnpackCode":""} [15:39:56.875] Using SSH config file "/Users/rusty/.ssh/config" [15:39:56.875] Running script with connection command: ssh -T -L 127.0.0.1:64760:127.0.0.1:40217 -o ConnectTimeout=15 -F '/Users/rusty/.ssh/config' fe bash [15:39:56.875] Spawning tunnel with: ssh -T -L 127.0.0.1:64760:127.0.0.1:40217 -o ConnectTimeout=15 -F '/Users/rusty/.ssh/config' fe bash << 'EOSSH' echo -e 'Connected to SSH Host - Please do not close this terminal' && while true; do sleep 180; echo -n ' '; done EOSSH [15:39:57.067] "install" terminal command done [15:39:57.067] Install terminal quit with output: [15:39:57.729] > Connected to SSH Host - Please do not close this terminal [15:39:57.729] Spawned SSH tunnel between local port 64760 and remote target port 40217 [15:39:57.730] Waiting for ssh tunnel to be ready [15:39:57.732] Tunneled port 40217 to local port 64760 [15:39:57.732] Resolved "ssh-remote+fe" to "port 64760" [15:39:57.804] ------ ```

Anything else?

No response

roblourens commented 1 month ago

This is my output, but I'm not using the fish shell

time screen -v
Screen version 4.09.00 (GNU) 30-Jan-22

real    0m0.020s
user    0m0.001s
sys     0m0.020s

I don't know what else it would be doing during that time, maybe @Tyriar has an idea. It seems basically external to vscode though. Do you have the problem with any other programs?

rusty-key commented 1 month ago

No, I tried to reproduce it in other terminals, no luck at all. It only happens with vscode external terminal and only in the initial connection. Even if I ssh from the server where I have the problem to itself, the problem disappears:

~/monorepo 
$ time screen -v
Screen version 4.09.00 (GNU) 30-Jan-22

________________________________________________________
Executed in   18.79 secs    fish           external
   usr time    3.02 secs    0.00 micros    3.02 secs
   sys time   15.77 secs  642.00 micros   15.77 secs

~/monorepo 
$ ssh me@spawnbox-febox-eu-rustykey
Welcome to fish, the friendly interactive shell

~/monorepo 
$ time screen -v
Screen version 4.09.00 (GNU) 30-Jan-22

________________________________________________________
Executed in   11.59 millis    fish           external
   usr time    0.36 millis  362.00 micros    0.00 millis
   sys time   11.27 millis  155.00 micros   11.12 millis

I can see the difference in env between these two sessions:

$ git diff -U0 env-w env-l
@@
+BROWSER=/home/me/.vscode-server/bin/f1e16e1e6214d7c44d078b1f0607b2388f29d729/bin/helpers/browser.sh
@@home/me/monorepo/_opa
+COLORTERM=truecolor
@@
-GPG_TTY=/dev/pts/39
+GPG_TTY=/dev/pts/25
@@
-PATH=/home/me/.bin:/home/rusty.key/.npm/node_modules/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/games
+PATH=/home/me/.bin:/home/rusty.key/.npm/node_modules/bin:/home/me/.vscode-server/bin/f1e16e1e6214d7c44d078b1f0607b2388f29d729/bin/remote-cli:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/games
@@
-SHLVL=1
-SSH_CLIENT=[redacted-1]
-SSH_CONNECTION=[redacted-1]
-SSH_TTY=/dev/pts/39
+SHLVL=3
+SSH_AUTH_SOCK=/tmp/ssh-XXXXKbRANi/agent.2403674
+SSH_CLIENT=[redacted-2]
+SSH_CONNECTION=[redacted-2]
@@
+TERM_PROGRAM=vscode
+TERM_PROGRAM_VERSION=1.91.1
@@
+VSCODE_GIT_IPC_HANDLE=/run/user/2013/vscode-git-9a56e19a94.sock
+VSCODE_IPC_HOOK_CLI=/run/user/2013/vscode-ipc-da2c86d7-8733-422a-99ff-dbd9ad4881c4.sock
@@
-XDG_SESSION_ID=4629196
+XDG_SESSION_ID=4502219

Maybe something looks suspicious?