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

Windows programs unable to communicate on localhost, maybe due to mirrored mode wsl bug. #11417

Open
1 of 2 tasks
peigongdsd opened this issue Apr 3, 2024 · 4 comments
Open
1 of 2 tasks
Labels

Comments

@peigongdsd
Copy link

Windows Version

Microsoft Windows [Version 10.0.26090.112]

WSL Version

WSL version: 2.2.1.0 Kernel version: 5.15.150.1-2 WSLg version: 1.0.60 MSRDC version: 1.2.5105 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.26090.112

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.150.1-microsoft-standard-WSL2

Distro Version

PRETTY_NAME="Ubuntu 22.04.3 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.3 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=jammy

Other Software

No response

Repro Steps

  • Reboot the machine.
  • After boot, try to connect to TCP services on localhost, from windows to windows. For example, an http server listening on localhost.
  • All the requests fail. The http page fails to load. Use wireshark to inspect the packages, and it seems that only part of the TCP stream is transmitted. This can also be seen by using curl or browser developer tools.
  • Start wsl, in network=NAT mode. Then request again.
  • Nothing changes.
  • Restart wsl in network=mirrored mode. Request.
  • Now everything suddenly works fluently. Http request from windows to windows work. Very wired.
  • Stop wsl, and things still work.

Expected Behavior

As above.

Actual Behavior

As above.

Diagnostic Logs

No response

Copy link

github-actions bot commented Apr 3, 2024

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How 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
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@peigongdsd
Copy link
Author

peigongdsd commented Apr 3, 2024

Well, just rebooting my machine to capture the bug.
This is the screenshot when I was trying to connect to sing-box dashboard on 127.0.0.1:9090/ui.

1
0

Seems the response TCP package is truncated. Here is another experiment. Use miniserve to serve a folder on port 3015, localhost, and try to connect. At first the connection just die, but when wsl is started, the connection suddenly works.

output.mp4

@peigongdsd
Copy link
Author

This is very annoying since it has happened for quite a while, and I need to start wsl every time on windows boot. I tried to debug this but due to lack of knowledge of the internal mechanism of mirrored mode network of wsl and windows network stack, little could be done.

@OneBlue OneBlue added the network label Apr 3, 2024
@chanpreetdhanjal
Copy link

Hi. Can you please collect networking logs by following the instructions below?
https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues

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

No branches or pull requests

3 participants