WSL: WSL2 freezes with high CPU usage on arm64
Version
Microsoft Windows [Version 10.0.22621.819]
WSL Version
- WSL 2
- WSL 1
Kernel Version
5.15.68.1
Distro Version
Ubuntu 22.04
Other Software
Programs used when freezes occur:
Node.js Angular.js (ng) postgresql
(WSL2 Terminals used in Visual Studio on Windows)
Repro Steps
Error occurs regularly, but randomly. Cannot give steps to reproduce …
Expected Behavior
I expected the WSL terminals to be always responsive.
Actual Behavior
Sometimes the WSL terminals freeze for more than 10 minutes and there is nothing I can do when this happens. I can’t execute any commands or even close running applications. During this time, my CPU runs between 35-99% of its capacity (1% in idle normally).
The command wsl.exe --shutdown also doesn’t work and just hangs.
Diagnostic Logs
https://drive.google.com/file/d/1lfqTItgadQkRguVXO0Bn-M7Z5b7v7gSf/view?usp=share_link
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 1
- Comments: 20
Continuing mortal kombat with this bug: I discovered that my “workaround” above was a case of luck. I’ve never been able to use
wsl.exe --shutdownsuccessfully subsequently.However, I noticed this possible dup : https://github.com/microsoft/WSL/issues/8529 and a comment therein that did work, at least the one time I’ve tried it so far.
This in an admin powershell:
Killed WSL2 and it re-started upon opening a new shell, docker working.
Wow I’m in disbelief. I’ve had this WSL2 freezing issue since 2020, so my Surface Pro X just sat there collecting dust.
lawndoc’s solution with turning off
generateHostsfixed the issue for me.I didn’t have any unexpected characters in my
/etc/wsl.conffile, so not sure if that’s the root cause. This is also a personal device, so can’t comment on domain-joined systems. But WSL2 no longer freezes for me, even after sleeping or staying locked for hours.Hey all, I have had this problem for well over a year and I finally solved it for myself. For me the bug was when WSL generates the
/etc/hostsfile inside of the Linux subsystem. The hosts file generator appended a bad control character of some kind after the line that contained my hostname. Removing the character wasn’t enough because WSL would regenerate the file, so I had to create/etc/wsl.confand addThen I could permanently remove the bad character in
/etc/hostswhich fixed it and WSL works as expected.I don’t have this issue on my home computer, so part of me wonders if this issue happens only on domain-joined systems when the hostname line includes a domain computer name. I have no evidence to back this up of course, but I’d be curious to hear from anyone else who this helps whether or not the system with the issue was domain-joined.
Some progress. On the theory that shells don’t start because they’re waiting on some process executed through
.bashrcor the like, I used my new powers to execute commands viawsl.exeand dumped the process list. I saw a bunch of processes running under my uid, recently started:So next I began
kill -9’ing the processes beginning with the last. Lo and behold, when I killed pid 3855:wsl --user root kill -9 3855my hung shell reanimated!Same for me on Surface Pro 9 (SQ3) PS C:\Users\bhh> wsl --version WSL version: 1.1.3.0 Kernel version: 5.15.90.1 WSLg version: 1.0.49 MSRDC version: 1.2.3770 Direct3D version: 1.608.2-61064218 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22623.1325
This consistently (randomly) happens on Volterra (Windows 11 Pro 22H2, build 22621.1194). VmmemWSL process CPU usage is very high when it freezes on its own and
wsl --shutdownalso doesn’t work and just hangs. I have to kill the “Windows Subsystem for Linux” process and restart WslService to get WSL working again.Also happens for me often on my surface pro X. Always on high cpu/io tasks after working for a few hours (docker build, npm build, git commit etc). Today it happened again on ctrl+c to close 3 running docker containers. Added the logs
WslLogs-2022-11-11_12-54-21.zip