Skip to content
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

WSL high CPU usage and hangs all requests after some sleep-resume or hibernate-resume cycles #9855

Open
1 of 2 tasks
MichaelXt opened this issue Mar 27, 2023 · 19 comments
Open
1 of 2 tasks

Comments

@MichaelXt
Copy link

Windows Version

Microsoft Windows [Version 10.0.22000.1696]

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.22000.1696

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

Default Distribution: Ubuntu-22.04 Default Version: 2 WSL1 is not supported with your current machine configuration. Please enable the "Windows Subsystem for Linux" optional component to use WSL1.

Distro Version

Ubuntu 22.04

Other Software

During the sleep-resume or hibernate-resume cycles following software is running:
vscode: 1.76.2, WSL extension: v0.76.1
explorer with wsl drive open

Repro Steps

Use wsl with vscode, open drives in windows explorer, use other apps which use the filesystem from the WSL.
Do a lot of sleep-resume cycles, while other software accessing the WSL works.
Once in a while after sleep-resume notice that the VmmemWSL process CPU usage is high. Attempt to access the WSL FS via explorer - it hangs opening it, use vscode - it says WSL is not responsive.
Try to shutdown the wsl to restart it using wsl --shutdown - the operation hangs, never completes.

Expected Behavior

The WSL always works normally after sleep-resume / hibernate-resume cycle.

Actual Behavior

After some sleep-resume / hibernate-resume cycles the WSL hangs, CPU usage spikes, and WSL doesn't respond to any commands. wsl --shutdown doesn't stops the wsl, and just hangs.

Diagnostic Logs

No response

@thfrei
Copy link

thfrei commented Mar 28, 2023

+1
Have the same issue with vmmem spking cpu usage.
However, wsl --shutdown will eventually close vmmem process and system returns to normal. Shutdown takes approx 1-2 minutes.

$>wsl --status
Default Distribution: Ubuntu
Default Version: 2

Windows Subsystem for Linux was last updated on 22.11.2022
WSL automatic updates are on.

Kernel version: 5.10.102.1

One trial to fix it was: I adapted the $USER/.wslconfig file according to: https://tkacz.pro/wsl-fix-vmmem-high-cpu-usage/ - However this solution does not really seem to fix the issue. Maybe it helps with shutdown working.

image

I read somewhere, that apparently it should not occur in Windows 11 anymore. Windows 11 also has some more wsl2 features like usb pass-through or mounting which is missing in Windows 10 :-(

@ghost
Copy link

ghost commented Mar 28, 2023

Is this on arm64 or amd64?

@MichaelXt
Copy link
Author

amd64

OS Name:                   Microsoft Windows 11 Home
OS Version:                10.0.22000 N/A Build 22000
OS Configuration:          Standalone Workstation
OS Build Type:             Multiprocessor Free
System Manufacturer:       Micro-Star International Co., Ltd.
System Type:               x64-based PC
Processor(s):              1 Processor(s) Installed.
                           [01]: Intel64 Family 6 Model 154 Stepping 3 GenuineIntel ~2900 Mhz
BIOS Version:              American Megatrends International, LLC. E1544IMS.505, 8/10/2022
Hotfix(s):                 6 Hotfix(s) Installed.
                           [01]: KB5022505
                           [02]: KB5008295
                           [03]: KB5012170
                           [04]: KB5019448
                           [05]: KB5023698
                           [06]: KB5022925
Network Card(s):           2 NIC(s) Installed.
                           [01]: Realtek Gaming 2.5GbE Family Controller
                                 Connection Name: Ethernet
                                 DHCP Enabled:    Yes
                           [02]: Intel(R) Wi-Fi 6E AX211 160MHz
                                 Connection Name: Wi-Fi
                                 Status:          Media disconnected
Hyper-V Requirements:      A hypervisor has been detected. Features required for Hyper-V will not be displayed.

@YAmikep
Copy link

YAmikep commented Apr 1, 2023

This high cpu issue has unfortunately been around for a while and Microsoft is very silent on it. 😞
See this other issue from 2021: #6982

@MichaelXt
Copy link
Author

WslLogs-2023-04-03_13-59-51.zip
uploaded the logs.

Couple differences:

  1. The high cpu usage is permanent, and doesn't go with time, nor with any attempts to restart wsl (the restart hangs forever)
  2. While the issue doesn't repro with each cycle, it does repro 2 out of 7 runs.

@mrobbeloth
Copy link

This seems like a power management issue as I regularly hibernate my system and this issue only makes itself evident coming out of hibernation (others have said sleep mode).

@benreaves
Copy link

@thfrei

One trial to fix it was: I adapted the $USER/.wslconfig file with guiApplications=false
... I read somewhere, that apparently it should not occur in Windows 11 anymore. Windows 11

I'm sorry to report, I had that line in .wslconfig, and I'm on Windows 11 (Dell XPS 17 purchased January 2022) and still had the vmmem 100% CPU problem.

@rngadam
Copy link

rngadam commented May 2, 2023

Just experienced the same thing this morning from sleep: (Ubuntu window unresponsive, wsl shutdown not returning, Visual Studio Code reporting containers not connected). Had to reboot.

WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
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.19045.2846
Default Distribution: Ubuntu
Default Version: 2

@rngadam
Copy link

rngadam commented May 4, 2023

Duplicate of #8696 ? That one has a workaround to properly kill WSL without rebooting.

@narbhar
Copy link

narbhar commented Nov 10, 2023

I can confirm this issue too. Vmmem high CPU usage after sleep. I had a VSCode session that was running before and it says it is disconnected now. In powershell, trying out wsl.exe --shutdown doesn't work either. The command just hangs. I can't access the Ubuntu (the distro on WSL) terminal when the CPU usage high.

@rngadam
Copy link

rngadam commented Nov 10, 2023

I can confirm this issue too. Vmmem high CPU usage after sleep. I had a VSCode session that was running before and it says it is disconnected now. In powershell, trying out wsl.exe --shutdown doesn't work either. The command just hangs. I can't access the Ubuntu (the distro on WSL) terminal when the CPU usage high.

Have you tried this workaround:

taskkill /IM wslservice.exe /F

in a console running as administrator to restart the VM.

I keep using that command regularly to restart WSL.

@i2van
Copy link

i2van commented Nov 10, 2023

Another workaround (requires PSTools):

pskill wslservice.exe & pskill wslhost.exe

@daniel5gh
Copy link

daniel5gh commented Nov 20, 2023

Having the same issue for a long time (1y+) on my laptop currently running:

WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.3693

This laptop I sleep and hibernate regularly.

On another machine that has always had win11 since installing WSL2, I never encountered this issue. This machine I only sleep regularly, hibernate is disabled.

I do not use vscode, I do use various IDEs from the JetBrains toolbox. But I always had a suspicion there was a link with docker-desktop, because when I run docker-desktop containers this issue occurs much more frequently. Today I noticed for the first time this issue occurred without docker-desktop running (which prompted me to search this issues thread once again).

My workaround used to be also like others report in this thread to use various ways to kill the WSL process, but since at least a few months I realized that just another hibernate/wake cycle also corrects the problem for the running WSL2 without having to restart WSL.

Hope that workaround works for you all too, as it is a lot more convenient than restarting WSL

@rngadam
Copy link

rngadam commented Nov 20, 2023

But I always had a suspicion there was a link with docker-desktop, because when I run docker-desktop containers this issue occurs much more frequently.

Note that in our case we specifically do not run docker-desktop but docker under WSL only and have the same issue.

My workaround used to be also like others report in this thread to use various ways to kill the WSL process, but since at least a few months I realized that just another hibernate/wake cycle also corrects the problem for the running WSL2 without having to restart WSL.

@daniel5gh interesting that another hibernate/wake cycle fixes this - thanks for the tip!

@felixschndr
Copy link

Has someone found a solution to this issue yet (other than another power cycle)? I am having to restart WSL after every hibernate which is about 2-3 times a day...
Did someone try reinstalling WSL yet?

@TETYYS
Copy link

TETYYS commented Jul 28, 2024

Has someone found a solution to this issue yet (other than another power cycle)? I am having to restart WSL after every hibernate which is about 2-3 times a day... Did someone try reinstalling WSL yet?

There is no proper solution, Microsoft ignores the problem.

@thfrei
Copy link

thfrei commented Jul 28, 2024

Has someone found a solution to this issue yet (other than another power cycle)? I am having to restart WSL after every hibernate which is about 2-3 times a day... Did someone try reinstalling WSL yet?

In my case, I eventually switched to Windows 11. There the problem disappeared.

@felixschndr
Copy link

@thfrei Did you factory reset windows after/before upgrading?

@thfrei
Copy link

thfrei commented Jul 28, 2024

@thfrei Did you factory reset windows after/before upgrading?

nope..., kept everything as is, and then used https://github.com/valinet/ExplorerPatcher to stay sane 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests