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.62k stars 277 forks source link

[Remote-SSH Bug]: Trying to connect to x86-64 Lima VM on ARM macOS host via Remote-SSH throws `std::bad_alloc` when attempting to start VS Code server #8391

Open cpolish opened 1 year ago

cpolish commented 1 year ago

Is there an existing issue for this bug?

Required Troubleshooting Steps

Connect Locally

It connects successfully

->

No response

Expected Behavior

The Remote-SSH extension should be able to connect to the running Lima VM instance, and install and run the VS Code server successfully.

Steps To Reproduce

  1. Create a Lima instance on an ARM macOS host, using QEMU for the virtualisation type, and 9p for the filesystem mount type.
  2. Include Lima's SSH config file in the user's SSH config file.
  3. Use the Remote-SSH extension to remotely to connect to the VM via SSH.
  4. After connecting, VS Code will install and attempt to run the VS Code server multiple times, but will fail: the final Remote-SSH output messages indicate Failed to set up socket for dynamic port forward to remote port <port>: Socket closed. Is the remote port correct?.
  5. In the VM, upon inspecting ~/.vscode-server/.<hash>.log, the log mentions the server terminating after throwing an instance of 'std::bad_alloc'.
  6. In the VM, attempting to manually run ~/.vscode-server/bin/<hash>/out/server-main.js will result in the same exception being thrown.

Remote-SSH Log

Remote-SSH Log

``` [11:26:32.915] Log Level: 2 [11:26:32.917] SSH Resolver called for "ssh-remote+lima-default", attempt 1 [11:26:32.917] "remote.SSH.useLocalServer": true [11:26:32.917] "remote.SSH.path": undefined [11:26:32.917] "remote.SSH.configFile": undefined [11:26:32.917] "remote.SSH.useFlock": true [11:26:32.917] "remote.SSH.lockfilesInTmp": false [11:26:32.917] "remote.SSH.localServerDownload": auto [11:26:32.918] "remote.SSH.remoteServerListenOnSocket": false [11:26:32.918] "remote.SSH.showLoginTerminal": false [11:26:32.918] "remote.SSH.defaultExtensions": [] [11:26:32.918] "remote.SSH.loglevel": 2 [11:26:32.918] "remote.SSH.enableDynamicForwarding": true [11:26:32.918] "remote.SSH.enableRemoteCommand": false [11:26:32.918] "remote.SSH.serverPickPortsFromRange": {} [11:26:32.918] "remote.SSH.serverInstallPath": {} [11:26:32.920] VS Code version: 1.77.3 [11:26:32.920] Remote-SSH version: remote-ssh@0.100.0 [11:26:32.920] darwin arm64 [11:26:32.923] SSH Resolver called for host: lima-default [11:26:32.923] Setting up SSH remote "lima-default" [11:26:32.925] Acquiring local install lock: /var/folders/2n/68kdw_gx05s8t6p76p1zlt6h0000gn/T/vscode-remote-ssh-9fc7ff50-install.lock [11:26:32.926] Looking for existing server data file at /Users/chris/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-9fc7ff50-704ed70d4fd1c6bd6342c436f1ede30d1cff4710-0.100.0/data.json [11:26:32.926] Using commit id "704ed70d4fd1c6bd6342c436f1ede30d1cff4710" and quality "stable" for server [11:26:32.928] Install and start server if needed [11:26:32.932] PATH: /Users/chris/.local/bin:/Users/chris/Library/Python/3.11/bin:/Users/chris/Library/Ruby/Gems/Current/bin:/Users/chris/Library/Rust/Cargo/bin:/opt/homebrew/opt/ruby@2.7/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/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 [11:26:32.932] Checking ssh with "ssh -V" [11:26:32.939] > OpenSSH_9.0p1, LibreSSL 3.3.6 [11:26:32.944] askpass server listening on /var/folders/2n/68kdw_gx05s8t6p76p1zlt6h0000gn/T/vscode-ssh-askpass-8ee5aa50db65126545f5bdcee84fed3f4ef47879.sock [11:26:32.944] Spawning local server with {"serverId":1,"ipcHandlePath":"/var/folders/2n/68kdw_gx05s8t6p76p1zlt6h0000gn/T/vscode-ssh-askpass-52dc475dc490e92961ebf156b2a30bbc00592ff9.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","50221","-o","ConnectTimeout=15","lima-default"],"serverDataFolderName":".vscode-server","dataFilePath":"/Users/chris/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-9fc7ff50-704ed70d4fd1c6bd6342c436f1ede30d1cff4710-0.100.0/data.json"} [11:26:32.945] Local server env: {"SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.YWpRXSEZwC/Listeners","SHELL":"/opt/homebrew/bin/zsh","DISPLAY":"/private/tmp/com.apple.launchd.EbpDsaL84F/org.xquartz:0","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/Users/chris/.vscode/extensions/ms-vscode-remote.remote-ssh-0.100.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"/Users/chris/.vscode/extensions/ms-vscode-remote.remote-ssh-0.100.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/var/folders/2n/68kdw_gx05s8t6p76p1zlt6h0000gn/T/vscode-ssh-askpass-8ee5aa50db65126545f5bdcee84fed3f4ef47879.sock"} [11:26:32.945] Spawned 11411 [11:26:33.011] > local-server-1> Running ssh connection command: "-v -T -D 50221 -o ConnectTimeout=15 lima-default" [11:26:33.013] > local-server-1> Spawned ssh, pid=11421 [11:26:33.016] stderr> OpenSSH_9.0p1, LibreSSL 3.3.6 [11:26:33.075] > ready: e41f4db1410b [11:26:33.084] > Linux 5.15.0-67-generic #74-Ubuntu SMP Wed Feb 22 14:14:39 UTC 2023 [11:26:33.084] Platform: linux [11:26:33.086] > /bin/bash [11:26:33.086] Shell: bash [11:26:33.086] Creating bash subshell inside "bash" [11:26:33.096] > bash version: 5.1.16(1)-release [11:26:33.131] > e41f4db1410b: running [11:26:33.252] > Acquiring lock on /home/chris.linux/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/vscode-remote-lock.chris.704ed70d4fd1c6bd6342c436f1ede30d1cff4710 [11:26:33.271] > Installing to /home/chris.linux/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710... [11:26:33.285] > e41f4db1410b%%1%% [11:26:33.300] > Downloading with wget [11:26:38.908] > Download complete [11:26:38.934] > e41f4db1410b%%2%% > tar --version: [11:26:38.937] > tar (GNU tar) 1.34 > Copyright (C) 2021 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later . > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. > > Written by John Gilmore and Jay Fenlason. [11:26:42.290] > Checking /home/chris.linux/.vscode-server/.704ed70d4fd1c6bd6342c436f1ede30d1cff4710.log and /home/chris.linux/.vscode-server/.704ed70d4fd1c6bd6342c436f1ede30d1cff4710.pid for a running server [11:26:42.353] > Running ssh connection command... /home/chris.linux/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/bin/code-server --start-server --host=127.0.0.1 --accept-server-license-terms --enable-remote-auto-shutdown --port=0 --telemetry-level off &> "/home/chris.linux/.vscode-server/.704ed70d4fd1c6bd6342c436f1ede30d1cff4710.log" < /dev/null > printenv: [11:26:42.361] > SHELL=/bin/bash > PWD=/home/chris.linux > LOGNAME=chris > XDG_SESSION_TYPE=tty > MOTD_SHOWN=pam > HOME=/home/chris.linux > LANG=C.UTF-8 > VSCODE_AGENT_FOLDER=/home/chris.linux/.vscode-server > SSH_CONNECTION=192.168.5.2 49947 192.168.5.15 22 > XDG_SESSION_CLASS=user > USER=chris > SHLVL=1 > XDG_SESSION_ID=4 > XDG_RUNTIME_DIR=/run/user/501 > SSH_CLIENT=192.168.5.2 49947 22 > XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop > PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/sbin:/sbin > DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/501/bus > OLDPWD=/home/chris.linux/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710 > _=/usr/bin/printenv [11:26:42.380] stderr> rm: cannot remove '/home/chris.linux/.vscode-server/.704ed70d4fd1c6bd6342c436f1ede30d1cff4710.token': No such file or directory [11:26:42.400] > Spawned remote server: 4985 [11:26:42.418] > Waiting for server log... [11:26:42.473] > Waiting for server log... [11:26:42.531] > Waiting for server log... [11:26:42.590] > Waiting for server log... [11:26:42.751] > Waiting for server log... [11:26:42.801] > Waiting for server log... [11:26:42.861] > Waiting for server log... [11:26:42.919] > Waiting for server log... [11:26:42.977] > Waiting for server log... [11:26:43.035] > Waiting for server log... [11:26:43.094] > Waiting for server log... [11:26:43.151] > Waiting for server log... [11:26:43.209] > Waiting for server log... [11:26:43.293] > > * > * Visual Studio Code Server > * [11:26:43.293] > * By using the software, you agree to > * the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and [11:26:43.293] > * the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement). > * > [11:26:43.333] > e41f4db1410b: start > SSH_AUTH_SOCK==== > DISPLAY==== [11:26:43.333] > webUiAccessToken==== > listeningOn==36671== > osReleaseId==ubuntu== > arch==x86_64== > tmpDir==/run/user/501== > platform==linux== > unpackResult==success== > didLocalDownload==0== > downloadTime==5634== > installTime==3311== > extInstallTime==== > serverStartTime==914== [11:26:43.334] > connectionToken==1a1aaa11-111a-11a1-111a-aaa111aaa111== [11:26:43.334] > e41f4db1410b: end [11:26:43.334] Received install output: SSH_AUTH_SOCK==== DISPLAY====webUiAccessToken==== listeningOn==36671== osReleaseId==ubuntu== arch==x86_64== tmpDir==/run/user/501== platform==linux== unpackResult==success== didLocalDownload==0== downloadTime==5634== installTime==3311== extInstallTime==== serverStartTime==914==connectionToken==1a1aaa11-111a-11a1-111a-aaa111aaa111== [11:26:43.335] Remote server is listening on 36671 [11:26:43.335] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":36671},"osReleaseId":"ubuntu","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/501","platform":"linux","connectionToken":"1a1aaa11-111a-11a1-111a-aaa111aaa111"},"downloadTime":5634,"installTime":3311,"serverStartTime":914,"installUnpackCode":"success"} [11:26:43.335] Persisting server connection details to /Users/chris/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-9fc7ff50-704ed70d4fd1c6bd6342c436f1ede30d1cff4710-0.100.0/data.json [11:26:43.339] Starting forwarding server. localPort 50226 -> socksPort 50221 -> remotePort 36671 [11:26:43.339] Forwarding server listening on 50226 [11:26:43.339] Waiting for ssh tunnel to be ready [11:26:43.340] Tunneled 36671 to local port 50226 [11:26:43.340] Resolved "ssh-remote+lima-default" to "127.0.0.1:50226" [11:26:43.341] [Forwarding server 50226] Got connection 0 [11:26:43.346] ------ [11:26:43.356] [Forwarding server 50226] Got connection 1 [11:26:44.175] ------ [11:26:44.175] SSH Resolver called for "ssh-remote+lima-default", attempt 2, (Reconnection) [11:26:44.176] SSH Resolver called for host: lima-default [11:26:44.176] Setting up SSH remote "lima-default" [11:26:44.177] Acquiring local install lock: /var/folders/2n/68kdw_gx05s8t6p76p1zlt6h0000gn/T/vscode-remote-ssh-9fc7ff50-install.lock [11:26:44.177] Looking for existing server data file at /Users/chris/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-9fc7ff50-704ed70d4fd1c6bd6342c436f1ede30d1cff4710-0.100.0/data.json [11:26:44.177] Found local server running: {"remoteListeningOn":{"port":36671},"osReleaseId":"ubuntu","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/501","platform":"linux","connectionToken":"1a1aaa11-111a-11a1-111a-aaa111aaa111","pid":11411,"ipcHandlePath":"/var/folders/2n/68kdw_gx05s8t6p76p1zlt6h0000gn/T/vscode-ssh-askpass-52dc475dc490e92961ebf156b2a30bbc00592ff9.sock","socksPort":50221,"startupTime":1681953992945} [11:26:44.177] Running server is stale. Ignoring [11:26:44.177] Using commit id "704ed70d4fd1c6bd6342c436f1ede30d1cff4710" and quality "stable" for server [11:26:44.180] Install and start server if needed [11:26:44.183] askpass server listening on /var/folders/2n/68kdw_gx05s8t6p76p1zlt6h0000gn/T/vscode-ssh-askpass-0330b301ea5ae5abcc46bc2d7ff39fe4b6fb5b16.sock [11:26:44.183] Spawning local server with {"serverId":2,"ipcHandlePath":"/var/folders/2n/68kdw_gx05s8t6p76p1zlt6h0000gn/T/vscode-ssh-askpass-36938954a415b380f230da96a091099900f56cc1.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","50231","-o","ConnectTimeout=15","lima-default"],"serverDataFolderName":".vscode-server","dataFilePath":"/Users/chris/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-9fc7ff50-704ed70d4fd1c6bd6342c436f1ede30d1cff4710-0.100.0/data.json"} [11:26:44.183] Local server env: {"SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.YWpRXSEZwC/Listeners","SHELL":"/opt/homebrew/bin/zsh","DISPLAY":"/private/tmp/com.apple.launchd.EbpDsaL84F/org.xquartz:0","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/Users/chris/.vscode/extensions/ms-vscode-remote.remote-ssh-0.100.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"/Users/chris/.vscode/extensions/ms-vscode-remote.remote-ssh-0.100.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/var/folders/2n/68kdw_gx05s8t6p76p1zlt6h0000gn/T/vscode-ssh-askpass-0330b301ea5ae5abcc46bc2d7ff39fe4b6fb5b16.sock"} [11:26:44.185] Spawned 11426 [11:26:44.186] [Forwarding server 50226] Got connection 2 [11:26:44.193] Failed to set up socket for dynamic port forward to remote port 36671: Socket closed. Is the remote port correct? [11:26:44.258] > local-server-2> Running ssh connection command: "-v -T -D 50231 -o ConnectTimeout=15 lima-default" [11:26:44.260] > local-server-2> Spawned ssh, pid=11436 [11:26:44.263] stderr> OpenSSH_9.0p1, LibreSSL 3.3.6 [11:26:44.331] > ready: e70010065abf [11:26:44.339] > Linux 5.15.0-67-generic #74-Ubuntu SMP Wed Feb 22 14:14:39 UTC 2023 [11:26:44.340] Platform: linux [11:26:44.341] > /bin/bash [11:26:44.341] Shell: bash [11:26:44.341] Creating bash subshell inside "bash" [11:26:44.352] > bash version: 5.1.16(1)-release [11:26:44.390] > e70010065abf: running [11:26:44.528] > Acquiring lock on /home/chris.linux/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/vscode-remote-lock.chris.704ed70d4fd1c6bd6342c436f1ede30d1cff4710 [11:26:44.550] > Found existing installation at /home/chris.linux/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710... [11:26:44.550] > Checking /home/chris.linux/.vscode-server/.704ed70d4fd1c6bd6342c436f1ede30d1cff4710.log and /home/chris.linux/.vscode-server/.704ed70d4fd1c6bd6342c436f1ede30d1cff4710.pid for a running server [11:26:44.557] > Looking for server with pid: 4985 [11:26:44.626] > Running ssh connection command... /home/chris.linux/.vscode-server/bin/704ed70d4fd1c6bd6342c436f1ede30d1cff4710/bin/code-server --start-server --host=127.0.0.1 --accept-server-license-terms --enable-remote-auto-shutdown --port=0 --telemetry-level off &> "/home/chris.linux/.vscode-server/.704ed70d4fd1c6bd6342c436f1ede30d1cff4710.log" < /dev/null > printenv: [11:26:44.634] > SHELL=/bin/bash > PWD=/home/chris.linux > LOGNAME=chris > XDG_SESSION_TYPE=tty > MOTD_SHOWN=pam > HOME=/home/chris.linux > LANG=C.UTF-8 > VSCODE_AGENT_FOLDER=/home/chris.linux/.vscode-server > SSH_CONNECTION=192.168.5.2 49947 192.168.5.15 22 > XDG_SESSION_CLASS=user > USER=chris > SHLVL=1 > XDG_SESSION_ID=4 > XDG_RUNTIME_DIR=/run/user/501 > SSH_CLIENT=192.168.5.2 49947 22 > XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop > PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/sbin:/sbin > DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/501/bus > _=/usr/bin/printenv [11:26:44.686] > Removing old logfile at /home/chris.linux/.vscode-server/.704ed70d4fd1c6bd6342c436f1ede30d1cff4710.log [11:26:44.697] > Spawned remote server: 5143 [11:26:44.717] > Waiting for server log... [11:26:44.773] > Waiting for server log... [11:26:44.830] > Waiting for server log... [11:26:44.887] > Waiting for server log... [11:26:44.944] > Waiting for server log... [11:26:45.000] > Waiting for server log... [11:26:45.058] > Waiting for server log... [11:26:45.134] > > * > * Visual Studio Code Server > * > * By using the software, you agree to [11:26:45.134] > * 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). > * > [11:26:45.175] > e70010065abf: start > SSH_AUTH_SOCK==== > DISPLAY==== > webUiAccessToken==== [11:26:45.175] > listeningOn==32981== > osReleaseId==ubuntu== > arch==x86_64== > tmpDir==/run/user/501== > platform==linux== > unpackResult==== > didLocalDownload==0== > downloadTime==== > installTime==== > extInstallTime==== [11:26:45.175] > serverStartTime==485== [11:26:45.175] > connectionToken==a1aa1111-1aaa-111a-a11a-a111aaaa1111== [11:26:45.176] > e70010065abf: end [11:26:45.176] Received install output: SSH_AUTH_SOCK==== DISPLAY==== webUiAccessToken====listeningOn==32981== osReleaseId==ubuntu== arch==x86_64== tmpDir==/run/user/501== platform==linux== unpackResult==== didLocalDownload==0== downloadTime==== installTime==== extInstallTime====serverStartTime==485==connectionToken==a1aa1111-1aaa-111a-a11a-a111aaaa1111== [11:26:45.176] Remote server is listening on 32981 [11:26:45.176] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":32981},"osReleaseId":"ubuntu","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/501","platform":"linux","connectionToken":"a1aa1111-1aaa-111a-a11a-a111aaaa1111"},"serverStartTime":485,"installUnpackCode":""} [11:26:45.176] Persisting server connection details to /Users/chris/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-9fc7ff50-704ed70d4fd1c6bd6342c436f1ede30d1cff4710-0.100.0/data.json [11:26:45.178] Starting forwarding server. localPort 50234 -> socksPort 50231 -> remotePort 32981 [11:26:45.178] Forwarding server listening on 50234 [11:26:45.178] Waiting for ssh tunnel to be ready [11:26:45.179] Tunneled 32981 to local port 50234 [11:26:45.179] Resolved "ssh-remote+lima-default" to "127.0.0.1:50234" [11:26:45.179] [Forwarding server 50234] Got connection 0 [11:26:45.181] ------ [11:26:45.186] [Forwarding server 50234] Got connection 1 [11:26:45.765] ------ [11:26:45.765] SSH Resolver called for "ssh-remote+lima-default", attempt 3, (Reconnection) [11:26:45.767] SSH Resolver called for host: lima-default [11:26:45.767] Setting up SSH remote "lima-default" [11:26:45.767] Acquiring local install lock: /var/folders/2n/68kdw_gx05s8t6p76p1zlt6h0000gn/T/vscode-remote-ssh-9fc7ff50-install.lock [11:26:45.768] Looking for existing server data file at /Users/chris/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-9fc7ff50-704ed70d4fd1c6bd6342c436f1ede30d1cff4710-0.100.0/data.json [11:26:45.768] Found local server running: {"remoteListeningOn":{"port":32981},"osReleaseId":"ubuntu","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/501","platform":"linux","connectionToken":"a1aa1111-1aaa-111a-a11a-a111aaaa1111","pid":11426,"ipcHandlePath":"/var/folders/2n/68kdw_gx05s8t6p76p1zlt6h0000gn/T/vscode-ssh-askpass-36938954a415b380f230da96a091099900f56cc1.sock","socksPort":50231,"startupTime":1681954004185} [11:26:45.770] Found running server - short-circuiting install [11:26:45.772] Starting forwarding server. localPort 50240 -> socksPort 50231 -> remotePort 32981 [11:26:45.772] Forwarding server listening on 50240 [11:26:45.772] Waiting for ssh tunnel to be ready [11:26:45.772] Tunneled 32981 to local port 50240 [11:26:45.772] Resolved "ssh-remote+lima-default" to "127.0.0.1:50240" [11:26:45.772] [Forwarding server 50240] Got connection 0 [11:26:45.774] ------ [11:26:45.776] Failed to set up socket for dynamic port forward to remote port 32981: Socket closed. Is the remote port correct? [11:26:45.781] [Forwarding server 50240] Got connection 1 [11:26:45.785] Failed to set up socket for dynamic port forward to remote port 32981: Socket closed. Is the remote port correct? [11:26:48.477] > local-server-1> Timed out [11:26:48.482] Local server exit: 0 ```

Anything else?

~/.vscode-server/.<hash>.log contents from VM after attempting to connect:

*
* 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).
*
Server bound to 127.0.0.1:32981 (IPv4)
Extension host agent listening on 32981

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)

I'm not sure of the exact cause of this, whether it could be the architecture, or something else, as there doesn't seem to be much information online regarding this issue with the Remote-SSH extension.

roblourens commented 1 year ago

Is it possible that your VM is out of memory?

Any idea @deepak1556?

cpolish commented 1 year ago

Hi, thanks for getting back. I've had a look at my VM's memory using top inside the VM, and in terms of memory usage, it should be OK (the VM has 4 GB of memory allocated to it, with ≈2.4 GB free). I've also tried splitting the terminal using tmux, and monitoring the memory usage using top in one pane, whilst running ./server.sh in the other pane (for the VS Code Server), but unfortunately, no dice: memory usage is stable, and it seems that the std::bad_alloc exception is thrown.

dsheng123 commented 1 year ago

I have the same issue as far as I can guess on Colima and also on lima directly. In my case I am trying to run a dotnet docker container on a x86_64 lima VM.

The same setup worked on the vz branch in December 2022 on an M1 Pro. So did anything change between now and then and does the CPU (now M2 Max) make a difference?

Does anyone have any idea?

KuttKatrea commented 1 year ago

I noted a similar error when running mongosh also on Colima and Lima. It seems has something to do between qemu and node, as both tools are based on it, but I haven't been able to pinpoint the problem or a combination of versions that work.

deepak1556 commented 1 year ago

Are you able to run Node.js https://nodejs.org/download/release/v16.17.1/ on this VM ?

KuttKatrea commented 1 year ago

In fact, I can't

user@lima-ubuntu:~/node-v16.17.1-linux-x64$ bin/node --version
v16.17.1

user@lima-ubuntu:~/node-v16.17.1-linux-x64$ bin/node
Welcome to Node.js v16.17.1.
Type ".help" for more information.
> terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)

user@lima-ubuntu:~/node-v16.17.1-linux-x64$

Environment created in a Apple M1 Pro (16 GB RAM) using:

Lima 0.15.1 QEMU 8.0.0

(Both installed using Homebrew)

limactl start --name=ubuntu template://ubuntu --set='.arch = "x86_64"'

NodeJS downloaded with:

wget https://nodejs.org/download/release/v16.17.1/node-v16.17.1-linux-x64.tar.gz

Also, it seems there is already a ticket on NodeJS for this issue:

https://github.com/nodejs/node/issues/40195

deepak1556 commented 1 year ago

Thanks for confirming! We would have to wait for the upstream issue to be resolved. Can you try with docker instead, upstream issue seems to report it to be resolved there.

josecanciani commented 1 year ago

Also found same problem reported here: https://github.com/nodejs/help/issues/4156

My case is similar, $ node show the same error, running on a Mac M1 qemu server, emulating a x86 Ubuntu emulation, with an Ubuntu guest and an old 10.x version of node. So it seems to indicate this is a node/qemu issue, rather than a vscode problem.

KuttKatrea commented 1 year ago

In fact, I can't

user@lima-ubuntu:~/node-v16.17.1-linux-x64$ bin/node --version
v16.17.1

user@lima-ubuntu:~/node-v16.17.1-linux-x64$ bin/node
Welcome to Node.js v16.17.1.
Type ".help" for more information.
> terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted (core dumped)

user@lima-ubuntu:~/node-v16.17.1-linux-x64$

Environment created in a Apple M1 Pro (16 GB RAM) using:

Lima 0.15.1 QEMU 8.0.0

(Both installed using Homebrew)

limactl start --name=ubuntu template://ubuntu --set='.arch = "x86_64"'

NodeJS downloaded with:

wget https://nodejs.org/download/release/v16.17.1/node-v16.17.1-linux-x64.tar.gz

Also, it seems there is already a ticket on NodeJS for this issue:

nodejs/node#40195

I repeated this test on QEMU 8.0.3 and it seemed to work just fine.

Maybe this was resolved on QEMU's side?

seonglae commented 11 months ago

@KuttKatrea My QEMU version is 8.1.1 and I'm still this experience this issue. Not sure about your Mac OS version tho, according to this thread https://github.com/lima-vm/lima/discussions/1605, This error might happens after MacOS 13.4 (mine is Mac 14.0)