devcontainers / cli

A reference implementation for the specification that can create and configure a dev container from a devcontainer.json.
https://containers.dev
MIT License
1.45k stars 203 forks source link

Devcontainer over ssh hanging forever when wsl2 vm has freezed. #860

Open ggjulio opened 1 month ago

ggjulio commented 1 month ago

Sometimes when reconnecting to remote VMs, the reconnection hangs foreverer on wsl -l -v This issue happen when the local wsl2 VM is frozen.

Not sure why it run wsl commands when connecting to a linux remote VM. But maybe we could add a timeout when wsl -l -v takes too much time.

[47109 ms] Dev Containers 0.375.1 over Remote - SSH 0.112.0 in VS Code 1.90.1 (611f9bfce64f25108829dd295f54a6894e87339d).
[47106 ms] Start: Resolving Remote
[47269 ms] Start: Loading environment from ExecServer
[47847 ms] Host OS: linux 5.4.278-1.el8.elrepo.x86_64
[47848 ms] Host CWD: /workspaces/my_repo
[47849 ms] Start: Run: /bin/sh 
[47930 ms] Start: Run in host: echo ~
[47963 ms] /home/vscode
[47964 ms] 
[47966 ms] Start: Run in host: id -un
[48010 ms] vscode
[48011 ms] 
[48014 ms] Start: Run in host:  (command -v getent >/dev/null 2>&1 && getent passwd 'vscode' || grep -E '^vscode|^[^:]*:[^:]*:vscode:' /etc/passwd || true)
[48058 ms] userEnvProbe: loginInteractiveShell (default)
[48059 ms] userEnvProbe: not found in cache
[48060 ms] userEnvProbe shell: /bin/bash
[48178 ms] userEnvProbe PATHs:
Probe:     '/tmp/coder-script-data/bin:/opt/java/openjdk/bin:/opt/node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/vscode/.local/bin:/tmp/coder.8APyDu'
Container: None
[48230 ms] Setting up container for folder or workspace: /workspaces/my_repo
[48241 ms] Host authority: ssh-remote+[redacted]
[48247 ms] Start: Run: wsl -l -v
ggjulio commented 1 month ago

Here is a workaround, open an admin terminal and kill the service :

taskkill /f /im wslservice.exe

It will kill the VM. If docker desktop is installed and running, it will automatically restart wsl2.

samruddhikhandale commented 3 weeks ago

@gauravsaini04 / @prathameshzarkar9 Can either of you help investigate the issue? thanks!