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

Most upvoted comments

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 --shutdown successfully 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:

taskkill /f /im wslservice.exe

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 generateHosts fixed the issue for me.

I didn’t have any unexpected characters in my /etc/wsl.conf file, 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/hosts file 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.conf and add

[network]
generateHosts=false

Then I could permanently remove the bad character in /etc/hosts which 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 .bashrc or the like, I used my new powers to execute commands via wsl.exe and dumped the process list. I saw a bunch of processes running under my uid, recently started:

david       3854    3845  0 09:48 pts/7    00:00:00 /bin/sh /usr/sbin/update-motd --show-only
david       3855    3854  0 09:48 pts/7    00:00:00 run-parts --lsbsysinit /etc/update-motd.d
david       3861    3855  0 09:48 pts/7    00:00:00 /bin/sh /etc/update-motd.d/50-landscape-sysinfo
david       3868    3861  0 09:48 pts/7    00:00:00 /usr/bin/python3 /usr/bin/landscape-sysinfo
david       3871    3868  0 09:48 pts/7    00:00:00 [who] <defunct>

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 3855 my 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 --shutdown also doesn’t work and just hangs. I have to kill the “Windows Subsystem for Linux” process and restart WslService to get WSL working again.

>wsl --version
WSL version: 1.0.3.0
Kernel version: 5.15.79.1
WSLg version: 1.0.47
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.1194

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