-
Notifications
You must be signed in to change notification settings - Fork 823
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 .exe
execution is very slow when .exe
is in WSL filesystem
#8943
Comments
I'm encountering the described behavior with all |
Based on the kernel version, I'm assuming you are using one of the pre-release Systemd WSL versions? Is this a new problem that you are experiencing only under that release or did the problem occur on "stock" Windows 11 WSL? |
I encountered the same problem. As @NotTheDr01ds said, I removed wsl preview (now the kernel version is back to |
@lucidfrontier45 In the hopes of narrowing this down a bit, you might want to try:
I'm not able to reproduce this myself using (currently) 0.68.2 or 0.68.4 on two different systems, so there's likely something system-dependent in the issue as well, it seems to me. |
@NotTheDr01ds Could you share me any document for installing specific version of WSL? I'll happy to test those version. |
No problem:
|
@NotTheDr01ds thank you so much. Can you also tell me how to revert to the stock WSL? |
Here is a simple benchmark program of vector dot product. I compiled it in Ubuntu 22.04 on WSL2 with mingw. /usr/bin/x86_64-w64-mingw32-g++ --std=c++17 -O3 --static main.cpp 1 Running the result a.exe inside WSL $ ./a.exe
s = 2.49998e+07
elapsed = 2.179[sec] 2 Running it from Windows PS D:\share> .\a.exe
s = 2.49998e+07
elapsed = 1.631[sec] 3 Running Linux binary built by $ ./a.out
s = 2.49998e+07
elapsed = 1.351[sec] The above result is obtained from preview version WSL. (Installed by Windows: 22H2 With stock WSL, 1 and 2 result the same duration about 1.6 sec. |
another benchmark, just memory allocation and free. 1 a.exe inside preview WSL $ /mnt/d/share/a.exe
elapsed = 11.487[sec] 2 a.exe in Windows PS D:\share> .\a.exe
elapsed = 5.282[sec] 3 a.exe inside stock WSL $ /mnt/d/share/a.exe
elapsed = 5.585[sec] 4 native Linux binary inside WSL $ ./a.out
elapsed = 0.612[sec] Compared it with the previous benchmark that runs vector dot product, I think the main cause of performance degradation is memory allocation. |
Whether the |
@lucidfrontier45 Looks like you already figured this out, but (for anyone else), you can uninstall the Preview just like you do with any Store application. After uninstalling (typically no reboot required), you'll be back to the built-in WSL release. So, for example:
Of course, you can also do the same through the "Add or Remove Programs" settings. |
Thank you for sharing how to install/uninstall. I tested the benchmark programs which I posted above. In both |
Hi I am experiencing the same on: What version shall we revert to? I believe I am using the stock install..? |
I made benchmarks using the main2.cpp provided above: Could you please elaborate what your "stock" version is? |
Stock WSL is what is bundled in the Windows. If you can use If you want to revert to stock WSL, you need to go to Windows system settings and remove WSL just like other apps. Unfortunately, Microsoft is going to remove the stock WSL in the future. |
I made a test with wsl kernel 5.10.102: using wsl version 1.1.2, kernel version does not make any difference. |
Executing the .exe encapsulated in cmd.exe /c does the trick for me. |
For me, it's not only that .exes within WSL filesystem are slow, but also even exes outside WSL are slow if launched with a $PWD that is inside WSL. But if you launch them with a PWD of /mnt/c and then use some means (eg powershell's Start-Process -WorkingDirectory) to set the correct working directory from the windows side, then it's nice and fast. |
Yes I also experienced that. I wonder if encapsulating in cmd/c only makes it faster because of pwd of cmd must be set to non-wsl dir anyhow (it does not support unc paths). |
I confirm: even without cmd.exe, the execution is fast (i.e comparable to native windows) if the cwd of the .exe is non-wsl AND the .exe itself is located on a non-wsl fs. Otherwise it get can terribly slow. |
I observed the same thing too. It is kind of odd, it only happened to certain computers. It becomes very slow whenever I try to access /mnt/c. But some computers work perfectly fine. I only see this happened to Windows 11. And I can use
This one works fine. The other one with 10.0.22621.1194 doesn't actually I have another one with
and it works fine. So i am not sure what is the root cause. |
I am on Windows 10. I think I occasionally observed even just ls being super slow to list files in /mnt/c, but it's been a while since I've seen that. Launching exes is consistently slow though. It always seems to be just over 10 seconds for me which makes me wonder if there could be some kind of timeout going on. |
What is your Windows version? It seems working better with |
Mine is 10.0.19045.2604 |
@benburrill so my colleague has the exactly same issue. Here is his path Windows 10, update doesn't work. upgrade to windows 11, with add a new wsl distro with ubuntu 22 and everything works smoothly. |
I have this too: starting Windows executables from WSL2 filesystems first hangs the program for ~90 seconds, then it runs. Executable started from Windows share takes nothing to start:
Same executable started from WSL2 filesystems takes 1m45sec to run (sic!)
|
My issue might have been different, but since upgrading to WSL 1.1.3.0, my seemingly related problem seems to have been resolved. |
Redirection to cat for every command help for me, but seems MS don't want to revolve this issue. |
It does not seems to be a pure kernel problem. I've got an instance with Linux kernel
|
Fixed for me by updating WSL to latest kernel: 5.10.102.1-microsoft-standard-WSL2 WSL2 Linux kernel updates: https://www.catalog.update.microsoft.com/Search.aspx?q=wsl |
Thanks for sharing your findings! Starting This update only applied to machines with the Windows Subsystem for Linux. Updating with
|
Same issue for me with kernel 5.15.90.1
|
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! |
I think it's still an issue. Is there an update? |
Version
Microsoft Windows [Version 10.0.22621.521]
WSL Version
Kernel Version
5.15.57.1
Distro Version
Ubuntu 20.04
Other Software
No response
Repro Steps
Expected Behavior
Windows executables run quickly in WSL.
Actual Behavior
Executables from
/mnt/c
run quickly. Same executables copied into WSL's Linux's filesystem run horribly slow.WSL hangs for a long time when starting execution of a Windows
.exe
file. During the hang it doesn't respond to interrupts such asctrl + c
.$ /mnt/c/WINDOWS/system32/whoami.exe
exec time 0s$ /tmp/whoami.exe
exec time 90 sDiagnostic Logs
WslLogs-2022-10-04_14-00-34.zip
The text was updated successfully, but these errors were encountered: