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

Services running in WSL 2 no longer accessible from Windows #9760

Closed
Trey96 opened this issue Mar 8, 2023 Discussed in #9744 · 16 comments
Closed

Services running in WSL 2 no longer accessible from Windows #9760

Trey96 opened this issue Mar 8, 2023 Discussed in #9744 · 16 comments

Comments

@Trey96
Copy link

Trey96 commented Mar 8, 2023

Discussed in #9744

Originally posted by Trey96 March 6, 2023
Not sure if anyone else is having this problem, but I searched and wasn't able to find anything related to my issue. It seems like the WSL localhost is no longer being shared with the Windows localhost, and I cannot access WSL services from Windows via localhost.

I am running multiple domains on Nginx inside of WSL 2. In my Windows hosts file I am pointing all of those domains to 127.0.0.1. Until recently that was working just fine. However it has stopped working completely, and when I try to connect to the domain from the browser (Chrome) I get a connection refused error. Further investigation reveals there are no ports listening on 80 for 127.0.0.1, in fact nothing appears to be active on 127.0.0.1 anymore, especially WSL which used to be active. It seems WSL 2 has stopped binding to localhost but I am not sure why.

WSL version: 1.1.3.0
Kernel version: 5.15.90.1
Windows version: 10.0.22621.1344 (Windows 11)
Distro: Ubuntu 20.04

I recently installed Docker on my computer which runs on WSL. So I am not sure if that might have caused problems. Though I have since uninstalled Docker, but it had not affect. I am not sure if this is a bug with WSL or something I am doing wrong.

Any help identifying what might be the problem or any pointers on how to resolve it (or troubleshoot further) is much appreciated!

Log Files (Updated 3/21/2023):

WslLogs-2023-03-21_23-12-21.zip

@ghost
Copy link

ghost commented Mar 8, 2023

Please use the issue template going forward. Please provide the output of ss -lntp on the guest(wsl), and netstat -an | findstr /c:"80" | findstr /c:"LISTENING" on the host(windows)

@ghost ghost added the needs-author-feedback label Mar 8, 2023
@Trey96
Copy link
Author

Trey96 commented Mar 8, 2023

@pmartincic, thanks for the quick reply!

The following is the command output:

ss -lntp (WSL)

image

netstat -an | findstr /c:"80" | findstr /c:"LISTENING" (Windows)

image

@ghost
Copy link

ghost commented Mar 8, 2023

Can you provide /logs?

  1. wsl --shutdown
  2. then start collecting logs
  3. Check that it's broken
  4. Stop the log collection

Smoke test on my VM seems ok?
image

@microsoft-github-policy-service
Copy link
Contributor

Hello! Could you please provide more logs to help us better diagnose your issue?

To collect WSL logs, download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging

Thank you!

@Chan0081
Copy link

Chan0081 commented Mar 9, 2023

Got a similar problem.
I've started a grpc service in wsl2, and I can access it from wsl inside. But LAN computors can't access it even after I configured port-forwarding by:
netsh interface portproxy add v4tov4 listenport=50066 listenaddress=0.0.0.0 connectport=50066 connectaddress=192.168.79.196
The error says:
UNAVAILABLE: Network closed for unknown reason

@jjz921024
Copy link

hi,I had the same problem,can't connect to grpc server written by golang running WSL2, but it fine running windows.
how can I solve it?

@sec
Copy link

sec commented Mar 10, 2023

WslLogs-2023-03-10_13-18-21.zip
Hi,
As a check/workaround try to disable IPv6 on your local LAN/WiFi card/connection - works for me at least.

edit: sorry this doesn't help either, problem still occurs.

@ghost
Copy link

ghost commented Mar 11, 2023

I'm sorry, I've gotten routed elsewhere and won't be able to look into this for the time being.

@sec
Copy link

sec commented Mar 21, 2023

@pmartincic
This seems to be issue for a lot of people - in the end, this render WSL useless in high load scenarios...

@ghost
Copy link

ghost commented Mar 21, 2023

@sec, I agree with you. Unfortunately I've gotten routed elsewhere. Your logs have something interesting in them, won't be able to look much right now.

@Trey9
Looks like log collection started roughly half a minute after you started the VM. Whatever I'm looking for is probably in that half minute before you started collecting logs.

wsl --shutdown
then start collecting logs
Check that it's broken
Stop the log collection

@Trey96
Copy link
Author

Trey96 commented Mar 22, 2023

@pmartincic

I apologize about that, not sure how that happened. But I uploaded the updated logs - Let me know if there is anything else you need

@cmendible
Copy link
Member

cmendible commented Apr 4, 2023

az login redirect fails with 1.1.3, 1.1.5, 1.1.6 & 1.1.7

Had to rollback to 1.0.3

WSL version: 1.1.7.0
Kernel version: 6.1.21.1-1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.23424.1000

ss -lntp (WSL)

State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 5 127.0.0.1:45049 0.0.0.0:* users:(("python3",pid=839,fd=4))

netstat -an | findstr /c:"LISTENING"

TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP 0.0.0.0:5040 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49664 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49665 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49666 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49667 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49668 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49669 0.0.0.0:0 LISTENING
TCP 127.0.0.1:2015 0.0.0.0:0 LISTENING
TCP 127.0.0.1:29678 0.0.0.0:0 LISTENING
TCP 172.21.96.1:139 0.0.0.0:0 LISTENING
TCP 192.168.1.104:139 0.0.0.0:0 LISTENING
TCP [::]:135 [::]:0 LISTENING
TCP [::]:445 [::]:0 LISTENING
TCP [::]:49664 [::]:0 LISTENING
TCP [::]:49665 [::]:0 LISTENING
TCP [::]:49666 [::]:0 LISTENING
TCP [::]:49667 [::]:0 LISTENING
TCP [::]:49668 [::]:0 LISTENING
TCP [::]:49669 [::]:0 LISTENING

@Trey96
Copy link
Author

Trey96 commented May 1, 2023

Seems to be working for me now, after updating

 Get-Process -Id (Get-NetTCPConnection -LocalPort 80).OwningProcess

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
    198      32     3364      10176       0.19  18008   3 wslrelay
netstat -an | findstr /c:"80" | findstr /c:"LISTENING"

  TCP    0.0.0.0:7680           0.0.0.0:0              LISTENING
  TCP    0.0.0.0:8090           0.0.0.0:0              LISTENING
  TCP    127.0.0.1:80           0.0.0.0:0              LISTENING
  TCP    [::]:7680              [::]:0                 LISTENING
WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.1635

@ghost
Copy link

ghost commented May 1, 2023

Thanks @Trey96 for the update.

The fix was in 1.2.1

@ghost ghost closed this as completed May 1, 2023
@sec
Copy link

sec commented Nov 15, 2023

Hi.
@pmartincic Sorry but this was not fixed. It's still an issue even after recent update to 2.0.9.0.
Network is crashing under high load and the only solution is to restart WSL2, but then again, when docker containers are run and accessed from Windows host, network will be down again.

@sec
Copy link

sec commented Nov 16, 2023

@pmartincic I have created sample code to repro this issue - https://github.com/sec/wsl-network-crash-test - should I open new issue or can we reopen this one, as it's still the same issue?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants