-
Notifications
You must be signed in to change notification settings - Fork 822
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 and Windows can bind listening TCP socket on 127.0.0.1 using same port without setting SO_REUSEADDR #7150
Comments
Thanks for reporting this @2pl. There is currently no mechanism to make the bind() call fail inside WSL2 if the port is in use in Windows. We might not need that flag on the Windows though. I'll look into that. |
Thank you @OneBlue for the details on how the relay works. |
This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request. Thank you! |
Windows Build Number
Microsoft Windows [Version 10.0.19042.1052]
WSL Version
Kernel Version
Linux version 5.4.72-microsoft-standard-WSL2 (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Oct 28 23:40:43 UTC 2020
Distro Version
Ubuntu 20.04
Other Software
No response
Repro Steps
Can be easily reproduced in two steps.
1/ using CMD or PowerShell start a process listening on 127.0.01:9999
At this point from Windows you can see one listener on port 9999
2/ from ubuntu do the same
Now from Windows you can see two listeners on port 9999
Note that the order of the steps matter a lot, as doing 2 before 1 would not trigger the issue.
For reference I used the python code snippet below :
Expected Behavior
At Step 2 expected behavior is a failure of the socat command because the address is already in use
Actual Behavior
The socat command happily succeeds, resulting in:
Diagnostic Logs
No response
The text was updated successfully, but these errors were encountered: