microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.18k stars 805 forks source link

wslrelay.exe keeps listening to dead connections #10601

Open VandalPaulius opened 10 months ago

VandalPaulius commented 10 months ago

Windows Version

10.0.22621.2361

WSL Version

2.0.4.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.123.1-1

Distro Version

Ubuntu 20.04

Other Software

Node 18.15.0 VSCode 1.83.0

Repro Steps

Expected Behavior

When connection handler (server) is shutdown, all routing to it and open connections should be terminated

Actual Behavior

Connections to nonexisting (already terminated) server are being kept. That happens to LISTENER and to WAITING connections Such as: (in this image there are no running listeners or callers for port 3000, but they are kept in here) image Same behaviour was observed on version: 2.0.4 1.2.5 1.1.3 This happens only to connections from Windows to WSL. Within WSL connections are working fine even for the ports that are stuck with LISTENING flag with dead listeners

Diagnostic Logs

No response

gurjmatharu commented 10 months ago

+1 had a similar issue

polak-jan commented 10 months ago

Having the same issue here. On a basically fresh Windows install, so can't even say when it started. All I know is that it was fine before the reinstall.

VandalPaulius commented 10 months ago

For me it was working for at least 2 years completely fine and suddenly stopped without any changes from my side

polak-jan commented 9 months ago

Is anyone looking into this? The issue is rendering WSL basically unusable for me.

My workflow requires working on two separate applications at the same time, one running on the Windows side, and one inside WSL. Because of this issue this means that any time I have to restart the application running inside WSL I have to either restart WSL as a whole, or switch the application to a different port. Neither of which is ideal to say the least.

VandalPaulius commented 9 months ago

Is anyone looking into this? The issue is rendering WSL basically unusable for me.

My workflow requires working on two separate applications at the same time, one running on the Windows side, and one inside WSL. Because of this issue this means that any time I have to restart the application running inside WSL I have to either restart WSL as a whole, or switch the application to a different port. Neither of which is ideal to say the least.

As a workaround maybe it's possible to run Ubuntu in some sort of VM for that and skipping WSL completely?

TheOnlyWei commented 6 months ago

I have the same issue. Started some process in WSL Ubuntu. Killed that process and then exited the Ubuntu console. Went to Windows environment and the ports used by my killed process is being used by the process called wlsrelay.

On my end, I fixed it by shutting down the WSL:

wsl --shutdown

And then restarting Docker Desktop that was using WSL.

dovholuknf commented 5 months ago

Another "me too" here. wsl --shutdown fixes it, but it's an unwieldy hammer...

ibrah3m commented 3 months ago

Hi everyone I do use tcpview and I kill the port manually no need to do wsl --shutdow image