-
Notifications
You must be signed in to change notification settings - Fork 859
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
Unable to connect to existing WSL instance because socket already exists in /run/WSL #7252
Comments
@OneBlue @benhillis Sorry for the unsolicited mention, but could you have a look at this? This is causing lasting trouble and confusion for a lot of users, even more so when mixed with the now fixed Plan 9 server bug... Mostly IDEs are affected, see e.g. https://youtrack.jetbrains.com/issue/IDEA-276250 I can confirm it still occurs in 0.58.3.0 on 10.0.22000.613. |
/logs |
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:
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! |
This issue has been automatically closed since it has not had any author activity for the past 7 days. If you're still experiencing this issue please re-open it. Thank you! |
I am having a similar issue. Wsl2 fails to start with the next message: "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. I am guessing it has something to do with the sockets inside the Ubuntu 20.04.4 because I restarted everything in the windows. This wsl worked (located on an external disk), and I was in the middle of downloading android over ssh connection (over vpn also) when the battery was drained. |
Is it fixed? My environment: ubuntu20.04@wsl2 and docker-desktop for win. Then I use bitbake to compile, then I can't connect wsl2 through wsl.exe But the virtual machine itself is running and I can link through ssh, including use vscode's remote-ssh. But it just can't link through wsl.exe, why? How to deal with it? |
Just for the record, this does not happen to me anymore in version 0.65.3.0 (kernel 5.15.57.1). Now seeing it was fixed in 0.64.0 (#7506 (comment)). |
Windows Build Number
Microsoft Windows [Version 10.0.21390.2025]
WSL Version
Kernel Version
5.10.16
Distro Version
Ubuntu 20.04.2
Other Software
No response
Repro Steps
Start WSL
Check /run/WSL. There should be 2 sockets on a newly started WSL instance.
Run "wsl.exe true" from another Windows Terminal window. This will exit correctly.
Check /run/WSL. There should now be 3 sockets.
The newly created socket was from the "wsl.exe true" command, and is no longer in use. This can be verified with fuser.
If wsl.exe is executed enough times, /run/WSL will eventually have a socket for every PID. At this point, no new connections to this WSL session will be possible.
Expected Behavior
Sockets in /run/WSL should be cleaned up.
Actual Behavior
Sockets in /run/WSL are not cleaned up. Eventually, wsl.exe is no longer able to connect to the existing WSL instance. At this point, dmesg is filled with messages like:
init: (23090) ERROR: Create:129: bind failed 98
stracing init, I see:
23090 mkdir("/run/WSL", 0777 <unfinished ...>
23090 <... mkdir resumed>) = -1 EEXIST (File exists)
23090 socket(AF_UNIX, SOCK_SEQPACKET|SOCK_CLOEXEC, 0 <unfinished ...>
23090 <... socket resumed>) = 10
23090 bind(10, {sa_family=AF_UNIX, sun_path="/run/WSL/23090_interop"}, 110 <unfinished ...>
23090 <... bind resumed>) = -1 EADDRINUSE (Address already in use)
23090 getpid( <unfinished ...>
23090 <... getpid resumed>) = 23090
23090 writev(3, [{iov_base="<3>init: (23090) ERROR: Create:129: bind failed 98\n", iov_len=51}, {iov_base=NULL, iov_len=0}], 2 <unfinished ...>
Diagnostic Logs
No response
The text was updated successfully, but these errors were encountered: