Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode WSL can't find and attach to Node processes #6766

Closed
mikicho opened this issue May 29, 2022 · 2 comments
Closed

VSCode WSL can't find and attach to Node processes #6766

mikicho opened this issue May 29, 2022 · 2 comments

Comments

@mikicho
Copy link

mikicho commented May 29, 2022

  • VSCode Version: 1.67.2
  • Local OS Version: Windows 10 (21H2 - 19044.1706)
  • Remote OS Version: Debian 11 (Bullseye)
  • Remote Extension/Connection Type: WSL
  • Logs:
[2022-05-29 09:13:13.783] Resolving wsl+Debian, resolveAttempt: 1
[2022-05-29 09:13:13.923] Starting VS Code Server inside WSL (wsl2)
[2022-05-29 09:13:13.923] Extension version: 0.66.3
[2022-05-29 09:13:13.923] Windows build: 19044. Multi distro support: available. WSL path support: enabled
[2022-05-29 09:13:13.924] No shell environment set or found for current distro.
[2022-05-29 09:13:14.024] WSL daemon log file: 
[2022-05-29 09:13:14.024] Probing if server is already installed: C:\Windows\System32\wsl.exe -d Debian -e sh -c "[ -d ~/.vscode-server/bin/c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5 ] && printf found || ([ -f /etc/alpine-release ] && printf alpine-; uname -m)"
[2022-05-29 09:13:14.241] Probing result: found
[2022-05-29 09:13:14.242] Server install found in WSL
[2022-05-29 09:13:14.243] Launching C:\Windows\System32\wsl.exe -d Debian sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5 stable code-server .vscode-server --host=127.0.0.1 --port=0 --connection-token=2413537160-2762212314-822688051-4205558247 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all'
[2022-05-29 09:13:14.335] Setting up server environment: Looking for /home/michael/.vscode-server/server-env-setup. Not found.
[2022-05-29 09:13:14.335] WSL version: 5.10.102.1-microsoft-standard-WSL2 Debian
[2022-05-29 09:13:14.335] WSL-shell-PID: 3553
[2022-05-29 09:13:14.335] Node executable: /home/michael/.vscode-server/bin/c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5/node
[2022-05-29 09:13:14.335] Starting server: /home/michael/.vscode-server/bin/c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5/bin/code-server --host=127.0.0.1 --port=0 --connection-token=2413537160-2762212314-822688051-4205558247 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all
[2022-05-29 09:13:14.639] *
[2022-05-29 09:13:14.639] * Visual Studio Code Server
[2022-05-29 09:13:14.639] *
[2022-05-29 09:13:14.639] * By using the software, you agree to
[2022-05-29 09:13:14.639] * the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
[2022-05-29 09:13:14.639] * the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
[2022-05-29 09:13:14.639] *
[2022-05-29 09:13:14.639] Server bound to 127.0.0.1:39321 (IPv4)
[2022-05-29 09:13:14.639] Extension host agent listening on 39321
[2022-05-29 09:13:14.639] 
[2022-05-29 09:13:14.639] [12:13:14] Extension host agent started.
[2022-05-29 09:13:14.646] Started local proxy server on 51215.
[2022-05-29 09:13:14.647] WSL resolver response: 127.0.0.1:51215
[2022-05-29 09:13:14.647] To debug connection issues, open a local browser on http://127.0.0.1:51215/version
[2022-05-29 09:13:14.647] Using 'wslExeProxy' to connect to the VS Code server as configured by setting 'remote.WSL2.connectionMethod'
[2022-05-29 09:13:14.647] 'wslExeProxy' should fix reconnection issues after sleep and network adapter changes.
[2022-05-29 09:13:14.647] Please report issues related with the new setting to https://github.com/microsoft/vscode-remote-release/issues/5894
[2022-05-29 09:13:14.647] To revert back to the old way of connecting, change setting 'remote.WSL2.connectionMethod' to 'wsl2VMAddress'.

Steps to Reproduce:

  1. Create a simple node.js file:
function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}
sleep(1000000);
  1. run it: node --inspect sleep.js
  2. open vscode
  3. Run "Debug: Attach to Node process" from the commands pallete
  4. VSCode can't find the process, or any other Node process

I find it with chrome://inspect

Does this issue occur when you try this locally?: Yes
Does this issue occur when you try this locally and all extensions are disabled?: Yes

image
image

@mikicho
Copy link
Author

mikicho commented May 30, 2022

I find the problem. VSCode uses ps to find the processes and AFAIK Debian doesn't include this command by default (meta packages list).
image

To fix this, install ps:
sudo apt inatall procps

@mikicho
Copy link
Author

mikicho commented May 30, 2022

Close this in favour to microsoft/vscode#150754

@mikicho mikicho closed this as completed May 30, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jul 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant