-
Notifications
You must be signed in to change notification settings - Fork 836
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
Only one port can be accessed by the host through localhost at the same time #4769
Comments
I think I'm running into this issue as well. I've just upgraded to 19536 and can't use vscode and my localhost:3000 app at the same time. |
Similar issue to previous comments, but slightly different error path. Windows 10 Pro Insider Preview Build 19536.rs_prerelease.191211-1446 (WSL 2 Enabled)
|
Same issue, multiple connections to localhost doesn't work after the update 19536.1000 Issue Identical to @ad-on-is 's comment. Don't know much about WSL's network arch to debug further. |
I have noticed that this is infinitely more flakey than just one port being available.
Not sure what steps I can/should take to debug WSL2 networking, but I can confirm the update to 19536 is what broke me. |
Thanks for reporting, there is an issue in Insider Fast, and a fix is coming in a future build (hopefully next week). |
I have a LAMP setup on Ubuntu and I have the same issue. I cannot access my sites when using localhost. Until the fix is coming, I found a workaround. Do a The only problem is this address changes when the VM restart. Windows 10.0.19041 |
Is there a way to downgrade to previous build? |
I witness that after |
I ran into this problem as well. For example, I start server A on port 3000 and server B on 4000. If I access server A first on 127.0.01:3000 on the windows side, but I cannot access server B on 127.0.0.1:4000. However, I can access server B using wsl's ip address (let's say 172.23.134.64:4000). If I start another server C on port 5000, I cannot access it from either ip. So if you are like me, that are only running at most 2 servers in WSL, you are fine for now, and can wait for the update to drop. |
@benhillis would you share an update on the fix? Any vague ETA? |
Any news on the fix? |
1 similar comment
Any news on the fix? |
Fix was delayed by holiday break but still inbound. |
Just installed 19541. Works for me :) |
19541 fixed it for me as well. Thanks @benhillis & WSL team! |
19541 Seems to have fixed vscode not being able to "fetch remote environment", However it does NOT seem to have fixed the issue of not being able to access more than one port at a time. I have a React project which runs on Follow these steps to recreate the behavior:
Fun thing is you can stop both the servers, ONLY start the gatsby project on It seems like the first port you use while WSL2 is active sticks and becomes the only one you can see from Windows, running |
@Joe-Pena i observed the same behavior before updating to 19541. :( was feeling hopeful about this version. Does VSCode work while your server is occupying a port? I've had to resort to just using VIM while leaving my react dev server up.. |
Also having this issue again with version 10.0.19592.1001 |
Updated from wsl 1 to 2 today and can cofirm this issue is still present. Slow ring, version 10.0.19041.173. Using @alexisferat 's fix for now... |
@benhillis please check our above comments, the issue if back in the latest versions. Thank you. |
Windows 200410-1438 Build 19608, no issue here! |
Windows Insider Slow Ring build 19041.207. No issue here trying OP's instructions. |
Just updated to version 10.0.19608.1000 and the issue appears to be resolved again |
If you're experiencing this issue again, could you please collect detailed logs for us (instructions here) and post them here so we can help diagnose it? Thank you! |
I faced the same problem and found that running Docker commands or any other command that creates listeners with sudo solves the problem! Adding the current user to the docker group made no difference. |
I was having issues with kubectl port-forward. What worked for me was stopping docker desktop(wsl2) windows. Then I ran the port-forward. It suddenly started to work again. I started docker desktop again and everything seems to work |
When upgrade WSL 1 to WSL 2 the apache2 conf only listen on tcp v6 (ubuntu 20.04). I solved this problem, apply configuration in file |
The issue still persists in slow ring. Is there any plan to fix it? It is breaking basic workflow of typical developer. I can't access page I'm hosting on linux therefore I can't use WSL to develop. |
Why is this issue closed? |
@kuzirashi Try disabling Fast Startup. If it works then you are hitting bug #5298 |
This issue comes and goes it seems. One day its working, next day its not. Some ports are working, some ports aren't. Not sure what is going on. Ex: last night everything was working, now i can't connect to my wsl's mysql from windows with localhost:3306. Where a http server running in 4444 is working fine. How does this localhost forward work actually? Can I run a powershell cmd to get a list of ports LXSS is current forwarding? Can I reset it? Edit it? |
@sarim Can you check if you have Fast Startup enabled? |
I had fast startup enabled. But I had explicitly disabled hibernate from powercfg. AFAIK fast startup doesn't effectively enables if there is no hiberfil.sys. Which I don't have bcz I disabled hibernate. Nevertheless I explicitly disabled fast startup from registry. |
It happened again. Restarting LxssManager from Task Manager -> Services didn't help. Had to restart windows. Now its working. |
It happened again. some specific ports not working for localhost:ports, but some other ports works. for example, i run node use localhost:3000 doesn't work, by changing the port number it does. |
@lemchen That sounds like docker/for-win#7196 |
yes , the port is in the range of excludedportrange by using netsh interface ipv4 show excludedportrange protococol=tcp. |
I've began experiencing (I think) some manifestation of this issue. I am not limited to one bound port at a time, but which ports are accessible from the Windows host seems arbitrary. I had ports 3000 and 222 working yesterday. After a shutdown, they are not working today. Additional testing of random ports has yielded the following results: (testing methodology:
The ports that work always work, even after The WSL-side iptables are blank: iptables-save output
|
@a-abella Open an elevated Powershell and post the output of these: |
Aha, I knew about
This is after a reboot since my previous comment, so it looks like the exclusions affecting my random port findings are now different. Your comment led me to #5306 , which suggested moving the dynamic port range with After moving the Start Port and rebooting things look sane again, and I can bind ports reliably from WSL2 again. Thanks a lot! |
Thanks for this, I wasted 4 hours finding out why it does not work... Did not think about changing port after seeing that a demo python server on 8000 was working fine... |
this has worked for me, thank you. |
Same problem as described above. Setup working fine with Docker for Windows & Kube. After restarting the computer, nothing works from the windows side. Running Edit 1: 2/2 restarts where Docker was set to run on startup this issue has occurred. I disabled this setting and i'll see what happens if Docker is started manually after a restart. |
Windows build number: 10.0.19536.1000
Steps to reproduce:
nc -l <PortA>
.http://localhost:PortA
, and the console can output the browser request body.nc -l <PortB>
.http://localhost:PortB
, the error ERR_CONNECTION_REFUSED directly appears.wsl.exe --shutdown
command, repeat the test in the order of 3, 4, 1, 2, and the result is that PortB can receive the packet, and PortA has an error ERR_CONNECTION_REFUSED.Another reproduction method:
Using vscode's wsl-remote plug-in, it can be started correctly through the
code .
command for the first time. After closing vscode and using the command to open it again, the file under wsl cannot be displayed and an error message is displayed.The text was updated successfully, but these errors were encountered: