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

WSL2: connection issues on localhost #2037

Closed
Kangaroux opened this issue Dec 15, 2019 · 19 comments
Closed

WSL2: connection issues on localhost #2037

Kangaroux opened this issue Dec 15, 2019 · 19 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded wsl2 WSL 2 related issues
Milestone

Comments

@Kangaroux
Copy link

  • 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)
@Kangaroux Kangaroux changed the title Extension host, WSL broken after Windows 19041.1 update Extension host, WSL Remote broken after Windows 19041.1 update Dec 15, 2019
@aeschli aeschli transferred this issue from microsoft/vscode Dec 16, 2019
@aeschli
Copy link
Contributor

aeschli commented Dec 16, 2019

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 aeschli added the info-needed Issue requires more information from poster label Dec 16, 2019
@Kangaroux
Copy link
Author

@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

@Kangaroux
Copy link
Author

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.

@aeschli
Copy link
Contributor

aeschli commented Dec 17, 2019

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.

@Kangaroux
Copy link
Author

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

@dsod
Copy link

dsod commented Dec 17, 2019

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

@Kangaroux
Copy link
Author

Can confirm a reboot fixed it for me as well.

@phenixdotnet
Copy link

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

@kobenauf
Copy link

kobenauf commented Dec 19, 2019

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

@Kangaroux
Copy link
Author

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.

@ghost
Copy link

ghost commented Dec 21, 2019

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

@samuelpares
Copy link

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.

@dsod
Copy link

dsod commented Dec 28, 2019

It's probably related to:
microsoft/WSL#4340
and
microsoft/WSL#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.

@aeschli aeschli changed the title Extension host, WSL Remote broken after Windows 19041.1 update WSL2: intermittent connection issues Dec 30, 2019
@aeschli aeschli changed the title WSL2: intermittent connection issues WSL2: connection issues on localhost Dec 30, 2019
@aeschli aeschli added wsl2 WSL 2 related issues and removed info-needed Issue requires more information from poster labels Dec 30, 2019
@aeschli aeschli added this to the January 2020 milestone Dec 30, 2019
@aeschli
Copy link
Contributor

aeschli commented Dec 30, 2019

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

@Zeswen
Copy link

Zeswen commented Jan 2, 2020

+1

@zoftdev
Copy link

zoftdev commented Jan 4, 2020

for interim, wsl --shutdown solve my problem.

@aeschli
Copy link
Contributor

aeschli commented Jan 6, 2020

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).

@aeschli aeschli closed this as completed Jan 6, 2020
@aeschli aeschli added the bug Issue identified by VS Code Team member as probable bug label Jan 27, 2020
@dbaeumer dbaeumer added the verified Verification succeeded label Jan 30, 2020
@dbaeumer
Copy link
Member

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

@ShadowEO
Copy link

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

@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded wsl2 WSL 2 related issues
Projects
None yet
Development

No branches or pull requests

10 participants