Vscode-remote-release: WSL2: connection issues on localhost

Created on 15 Dec 2019  路  19Comments  路  Source: microsoft/vscode-remote-release

  • VSCode Version: 1.41.0
  • OS Version: 19041.1

_Does this issue occur when all extensions are disabled?: Yes_

After upgrading my windows insider build last night vscode is giving ECONNREFUSED errors.

I'm unable to manage any of my extensions. Under the recommended extensions tab it says "We cannot connect to the Extensions Marketplace at this time, please try again later."

Additionally, the Terminal window is stuck on "Starting...". I can't open any projects in WSL, and opening projects as non-WSL still gives extension errors. Opening a WSL project gives "Could not fetch remote environment."

  ERR [remote-connection][Management   ][34e4c鈥[initial][::1:43659] socketFactory.connect() failed. Error:
log.ts:196   ERR Error: connect ECONNREFUSED ::1:43659
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054)
log.ts:196   ERR [remote-connection] An error occurred in the very first connect attempt, it will be treated as a permanent error! Error:
log.ts:196   ERR Error: connect ECONNREFUSED ::1:43659
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054)
notificationsAlerts.ts:40 Failed to connect to the remote extension host server (Error: connect ECONNREFUSED ::1:43659)
onDidNotificationChange @ notificationsAlerts.ts:40
notificationsAlerts.ts:40 Could not fetch remote environment
onDidNotificationChange @ notificationsAlerts.ts:40
2log.ts:196   ERR Error: Unable to read file (Error: connect ECONNREFUSED ::1:43659)
    at _.doReadAsFileStream (fileService.ts:456)
    at processTicksAndRejections (internal/process/task_queues.js:89)
log.ts:196   ERR [remote-connection][ExtensionHost][55dfe鈥[initial][::1:43659] socketFactory.connect() failed. Error:
log.ts:196   ERR Error: connect ECONNREFUSED ::1:43659
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054)
log.ts:196   ERR [remote-connection] An error occurred in the very first connect attempt, it will be treated as a permanent error! Error:
log.ts:196   ERR Error: connect ECONNREFUSED ::1:43659
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054)
extensionHostProcessManager.ts:77 Error received from starting extension host
(anonymous) @ extensionHostProcessManager.ts:77
extensionHostProcessManager.ts:78 Error: connect ECONNREFUSED ::1:43659
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054)
(anonymous) @ extensionHostProcessManager.ts:78
2log.ts:196   ERR connect ECONNREFUSED ::1:43659: Error: connect ECONNREFUSED ::1:43659
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054:14)
bug verified wsl2

Most helpful comment

I just released a new version of the extension - Remote - WSL 0.42.1 - that should work around the issue by connecting to the WSL2 VM IP. It requires VSCode Insiders (1.42.0). It would be great if you can give it a try. If it works I can also make a version for the stable VSCode (1.41.1).

All 19 comments

I'm not able to reproduce on Windows 19041.1 (Build 19041.vb_release.191206-1406)

Can you paste what's in the WSL Log (Use Remote-WSL: Show Log)?

@aeschli

[2019-12-16 15:36:14.819] Resolving wsl+ubuntu, resolveAttempt: 1
[2019-12-16 15:36:14.865] Starting VS Code Server inside WSL (Ubuntu)
[2019-12-16 15:36:14.865] Extension version: 0.41.5, Windows build: 19041. Multi distro support: available. WSL path support: enabled
[2019-12-16 15:36:15.000] Connecting to daemon started by other Remote-WSL window... 4.19.84-microsoft-standard Ubuntu
[2019-12-16 15:36:15.000] WSL resolver response: ::1:43659
[2019-12-16 15:36:15.000] To debug connection issues, open a local browser on http://[::1]:43659/version
$ curl localhost:43659/version
9579eda04fdb3a9bba2750f15193e5fafe16b959

If I open a project without WSL the bash terminal works as expected. I checked the permissions for the .vscode_server folder and everything seems to be fine.

Thanks @Kangaroux
Can you close all VSCode windows, and check with ps -ax in the WSL terminal that there's are no more VSCode server processes running (kill the processes, if necessary).

Then open a WSL window again and copy the WSL log.

What do you mean by project without WSL?
Screenshots would be helpful to understand the issue you're seeing.

When I say a project without using WSL I mean using this:

image

[2019-12-17 11:45:35.463] Resolving wsl+ubuntu, resolveAttempt: 1
[2019-12-17 11:45:35.517] Starting VS Code Server inside WSL (Ubuntu)
[2019-12-17 11:45:35.517] Extension version: 0.41.6, Windows build: 19041. Multi distro support: available. WSL path support: enabled
[2019-12-17 11:45:35.664] Probing if server is already installed: C:\WINDOWS\System32\wsl.exe -d Ubuntu -e sh -c "[ -d ~/.vscode-server/bin/9579eda04fdb3a9bba2750f15193e5fafe16b959 ] && printf found || ([ -f /etc/alpine-release ] && printf alpine-; uname -m)"
[2019-12-17 11:45:35.771] Probing result: found
[2019-12-17 11:45:35.771] Server install found in WSL
[2019-12-17 11:45:35.771] Launching C:\WINDOWS\System32\wsl.exe -d Ubuntu sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" 9579eda04fdb3a9bba2750f15193e5fafe16b959 stable .vscode-server 0  ' in c:\Users\rouxj\.vscode\extensions\ms-vscode-remote.remote-wsl-0.41.6
[2019-12-17 11:45:35.977] Setting up server environment: Looking for /home/jesse/.vscode-server/server-env-setup. Not found.
[2019-12-17 11:45:35.977] WSL version: 4.19.84-microsoft-standard Ubuntu
[2019-12-17 11:45:35.977] WSL2-shell-PID: 5747
[2019-12-17 11:45:35.977] Starting server: /home/jesse/.vscode-server/bin/9579eda04fdb3a9bba2750f15193e5fafe16b959/server.sh  --port=0 --enable-remote-auto-shutdown 
[2019-12-17 11:45:36.278] 
[2019-12-17 11:45:36.278] 
[2019-12-17 11:45:36.278] *
[2019-12-17 11:45:36.278] * Visual Studio Code Server
[2019-12-17 11:45:36.278] *
[2019-12-17 11:45:36.278] * Reminder: You may only use this software with Visual Studio family products,
[2019-12-17 11:45:36.278] * as described in the license https://aka.ms/vscode-remote/license
[2019-12-17 11:45:36.278] *
[2019-12-17 11:45:36.278] 
[2019-12-17 11:45:36.278] 
[2019-12-17 11:45:36.278] IP Address: 172.29.175.9
[2019-12-17 11:45:36.278] Extension host agent listening on 38145
[2019-12-17 11:45:36.278] 
[2019-12-17 11:45:36.278] 
[2019-12-17 11:45:36.278] [06:45:36] Extension host agent started.
[2019-12-17 11:45:36.279] WSL resolver response: ::1:38145
[2019-12-17 11:45:36.279] To debug connection issues, open a local browser on http://[::1]:38145/version

I have the exact same issue. But i'm not sure the issue is related to the Windows update for me. It has happened now and then for a while. A reboot solves the issue.

OS Version: 19041.1
VSCode Version: 1.41.0

Running Ubuntu-18.04 WSL 2

Can confirm a reboot fixed it for me as well.

Hi,
Same issue, appearing just after updated to Windows 10 Insider 19536.
I got it in both stable and insider version of VS code.

A curl from powershell fail:

> curl "http://[::1]:42437/version"
curl: (7) Failed to connect to ::1 port 42437: Connection refused

But a curl from ubuntu is ok:

> curl "http://[::1]:42437/version"
9579eda04fdb3a9bba2750f15193e5fafe16b959

Version:
Version: 1.41.0 (user setup)
Commit: 9579eda04fdb3a9bba2750f15193e5fafe16b959
Date: 2019-12-11T18:37:42.077Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.19536

I have this problem too, and I wonder if it is related to https://github.com/microsoft/vscode-remote-release/issues/103

I am also trying to track down an issue where sometimes when I start a node program in bash (wsl 2), localhost is accessible from my browser in Windows, and sometimes it's not.

It seems like if I reboot, if I first start my program, I am able to connect to localhost from my browser, but then running code . from bash leads to VSC having the connection errors reported in this issue.

However, if I reboot and first run code ., VSC loads correctly, but then my browser is unable to connect to my program on localhost.

Here are other possibly related issues:
https://github.com/microsoft/WSL/issues/2471
https://github.com/microsoft/WSL/issues/4353

Node has been a bit flaky for me as well, whether I'm running it directly or through Docker. Most of the time it's fine, though sometimes I can only access it via curl and not through my browser. I haven't found any pattern with it happening.

I can confirm a reboot fixed it for me, too.

I have this problem too, and I wonder if it is related to #103

I am also trying to track down an issue where sometimes when I start a node program in bash (wsl 2), localhost is accessible from my browser in Windows, and sometimes it's not.

It seems like if I reboot, if I first start my program, I am able to connect to localhost from my browser, but then running code . from bash leads to VSC having the connection errors reported in this issue.

However, if I reboot and first run code ., VSC loads correctly, but then my browser is unable to connect to my program on localhost.

Here are other possibly related issues:
microsoft/WSL#2471
microsoft/WSL#4353

Exactly what is happening to me, what I open first, runs, after that, I only get connection refused.

It's probably related to:
https://github.com/microsoft/WSL/issues/4340
and
https://github.com/microsoft/WSL/issues/4769

The 'only one port works' makes sense as all of us manage to get it working after a reboot and if we start vscode first after reboot.

Is it possible for the VSCode server to use IP instead of localhost? Looks like we could use that as a work around for now.

I'll add an option to use the ip address as a workaround.

+1

for interim, wsl --shutdown solve my problem.

I just released a new version of the extension - Remote - WSL 0.42.1 - that should work around the issue by connecting to the WSL2 VM IP. It requires VSCode Insiders (1.42.0). It would be great if you can give it a try. If it works I can also make a version for the stable VSCode (1.41.1).

Using VS Code with WSL2 verz frequently and have not seen the issue. Marking as verified,

VSCode Insiders version of the extension seems to work fine, although I had a connection issue attempting to open a remote folder.

Was this page helpful?
0 / 5 - 0 ratings