microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.26k stars 812 forks source link

All WSL commands hang (including wsl --shutdown) but WSL is constantly using 30-40% CPU #8529

Open dennisameling opened 2 years ago

dennisameling commented 2 years ago

Version

Microsoft Windows [Version 10.0.22621.160]

WSL Version

Kernel Version

5.10.102.1

Distro Version

Ubuntu 20.04

Other Software

No response

Repro Steps

This mostly seems to be happening when the device wakes from sleep - after a system restart, I can access the WSL distro as expected

image

Expected Behavior

Actual Behavior

Diagnostic Logs

Feedback Hub logs: https://aka.ms/AAh9fcl

swebs commented 1 year ago

Unfortunately the workaround that requires admin is not helpful for users without admin privileges. Need to reboot.

UmanShahzad commented 1 year ago

Upgrading to the latest Windows (Version 10.0.22621 Build 22621) seemed to made the problem go away for me.

jonas-veselka commented 1 year ago

Hi, this happens to me too. Please reopen the issue.

ryanshrott commented 1 year ago

How to fix this issue?

link89 commented 1 year ago

It happens when I try to restart wsl2 to work around the notorious inter op broken issue (https://github.com/microsoft/WSL/issues/5065). wsl --shutdown just get stuck and if I cancel it with ctrl+c, I cannot even enter the wsl environment again. wsl --shutdown just works well when inter op is OK, which makes me think those 2 issues may have some connections.

Montimort commented 1 year ago

I'm having a similar (the same?) issue. WSL execution stuck, but I have ~0 CPU usage, and cannot use wsl --shutdown. Please reopen and do not automatically close after 7 days.

zawasp commented 1 year ago

Similar issue, in my case this happens 100% of time when waking up the computer from sleep. This is happening since a Windows and/or WSL update 1-2 months back. The only solution which works (apart from restarting Windows) is: taskkill /f /im wslservice.exe . Docker Desktop then prompts me to restart it. It's really annoying as I have to reopen all my console windows and VS Code.

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

Distributor ID: Ubuntu Description: Ubuntu 22.04.1 LTS Release: 22.04 Codename: jammy

mklueh commented 1 year ago

Happening quite often recently after starting to use IntelliJ Remote Development with WSL

taskkill /f /im wslservice.exe

helped

manuelemacchia commented 1 year ago

This started happening to me after upgrading WSL to the Microsoft Store version. Interestingly, when the problem occurs, both of my distributions (Ubuntu and Debian) hang and CPU usage goes to 80-90%.

The only way to (temporarily) solve the problem is to open a PowerShell shell as administrator and use taskkill /f /im wslservice.exe.

devision-milen-dzhambazov commented 1 year ago

Same issue here. Using WSL2... wsl --shutdown hangs as does any other wsl command. taskkill /f /im wslservice.exe results in ERROR: The process "wslservice.exe" not found. How to properly force kill/restart WSL in this situation without rebooting?

MaxRev-Dev commented 1 year ago

I can confirm that this issue also haunts me. This occurs whenever my laptop goes to sleep.
Suspending the WSL does not help. Only killing it with taskkill /f /im wslservice.exe helps until the next system wake-up. I'm using Docker, so I must restart a docker service.

TETYYS commented 1 year ago

Could you also share the output of wsl.exe dmesg?

Thanks!

https://github.com/microsoft/WSL/issues/8529#issuecomment-1169249606

All commands hang, including wsl dmesg

bsmith1180 commented 1 year ago

I've been having the same issue; in my case, I managed to solve it by running "wsl --shutdown" (which hung), and then restarting docker desktop from the task tray.

moritonal commented 1 year ago

Yep, all commands hang, including wsl dmesg. Please fix this once and for all, I have work unaccessible within wsl.

swebs commented 1 year ago

Since this issue is closed, it may not receive much attention from from the maintainers. If there is someone who can reproduce this issue and is willing to keep interacting with the ticket to keep it open, it might make sense to file a new issue (not sure if this is best advice but what else can we do?). You can reference this ticket in the new one...

MaxRev-Dev commented 1 year ago

@craigloewen-msft Could you please reopen this?

mklueh commented 1 year ago

This looks like a follow-up of the same issue that is currently open.

https://github.com/microsoft/WSL/issues/9429

fil7er commented 1 year ago

As a palliative solution. I managed by removing Docker Desktop and WSL installation in Windows Features, then installing all again. Of course don't forgot to make a backup of the .docker folder

foremtehan commented 1 year ago

I put my PC into sleep every night so here i am.

robindegen commented 1 year ago

I also had this issue on Windows 11. Using the taskkill command helped.

drekinov commented 1 year ago

Day or two ago the issue started. each time laptop return from sleep WSL terminals are closed. new terminals are not starting. wsl --shutdown is not working. taskkil work some times .. at some point i have to restart to fix the issue.

biggest issue is that i am using recommended very low sleep / hibernate timeouts to save power as suggested by windows 11 itself both on battery and AC so .. each quick talk with someone lead to WSL kill and open everything again.

MichalLechowski commented 1 year ago

You probably have LxssManager service stuck at stopping state like me and only Windows restart helps.

What I did to make WSL2 and Docker usable on Windows 10 (latest) on a daily basis, since I cannot work without minikube cluster running in Docker, is I always stop containers in Docker before I put my laptop to sleep. I also use Ubuntu 18.04 for WSL2 purposes. I have .wslconfig set up to restrict both swap and memory to bare minimum I need to run a minikube cluster, because WSL2 will drain every single bit of RAM you allow it to. And I also use Ubuntu script to clear swap and ram that I trigger from time to time over bash to release excessive ram usage by vmmem process.

I know it's not a proper solution, but a workaround, but I cannot wait for something that doesn't exist, need to make a buck, after all. I have been testing this approach for around 2 weeks now and it hasn't failed on me so far and I never shut down my business laptop, it usually runs out of battery during weekend breaks, tho. So when I launch my laptop, I start docker container(-s), re-start minikube cluster on it, occasionally run Ubuntu clean up script and I'm good to go. Not a single WSL2 hang so far, nor excessive ram usage growin over time.

I have been trying to find a better/proper solution for like 2 days, no go. Everyone just says restart wsl or restart windows, as if that was a viable solution for software developers.

davidsr2r commented 1 year ago

Experienced the same issue here with wsl --shutdown hanging and vmmemwsl with high CPU usage, all happening after a sleep of my laptop. A windows restart didn't help me. @craigloewen-msft I'm joining others in asking for you to please re-open this ticket, would be a huge quality of life improvement to not have to deal with these issues.

kumorig commented 1 year ago

Same problem, access denied when trying to kill the process. I went to Services-tab in task manager, and stopped the "WsLService", the service auto-restarts but the process VmmemWSL is gone.

All good until it just happens again...?

mirabilos commented 1 year ago

I have a system with a WSL 1 system I ssh into, and a WSL 2 VM. I switch to the latter by running cmd in the former, then wsl -d Debian under CMD.

The latter recently has started to hang, the same way as described here. How can I fix that without losing the sshd on the WSL 1 system?

davidsr2r commented 1 year ago

I just updated Docker, might have been the issue since the release notes mentioned WSL restart issues being resolved. Haven't put this to the test yet though.

mirabilos commented 1 year ago

davidsr2r dixit:

I just updated Docker, might have been the issue

Not here, not using Docker.

davidsr2r commented 1 year ago

It came back for me :/

OliverKillane commented 1 year ago

Also having this issue:

Restarting machine rectifies.

poppops commented 1 year ago

I've been experiencing the same issue for a whle now. I keep checking different threads to see if there's an actual fix and not just killing wslservice.exe.

What do we need to do to even get some acknowledgement?

I don't think it's as simple as a low memory thing as one user suggested - 16GB isn't pushing limits but I wouldn't say it's low.

I've got 32GB of RAM, DDR4 and DDR5 laptops and I'm facing this issue, especially when waking from sleep.

This is a relatively recent issue (in the last year) as I was not experiencing this in 2021 and 2022 on Windows 10 and early releases of Windows 11.

robindegen commented 1 year ago

Update: I found that that specifically in my case the issue was likely due to a poorly written USB floppydrive driver. I don't think this is the case for everyone, but I thought I should mention.

gemmell commented 1 year ago

@robindegen Details please? We use vscode dev containers and having to reboot or even wsl --shutdown is killing us all slowly.

Novak-Peter commented 1 year ago

Same issue here (after restoring from hibernate), all wsl commands including wsl --shutdown hangs (that helped previously, ~1-2 months ago), however taskkill /f /im wslservice.exe was working without reboot.

Montimort commented 1 year ago

We solved this issue by moving all dev machines and servers to real linux. Good bye M$

PHENOMICAL commented 1 year ago

Also got this issue. CPU Usage of the Vmmem.exe process shoots up to 90% usage, seemingly at random.

taskkill /f /im wslservice.exe works, but it's rather annoying to do this every time this issue occurs.

Hopefully there will be a fix one day soon, but I understand that identifying the source of this problem can be quite difficult and maybe this is an environment issue (Drivers, hardware, etc.).

robindegen commented 1 year ago

@robindegen Details please? We use vscode dev containers and having to reboot or even wsl --shutdown is killing us all slowly.

Not much to say unfortunately. I have a usb floppy drive made from the finest chineseum and it was causing the problems for me. When I leave it unplugged I never have wsl issues anymore. When I have it plugged in, every so often the whole thing just locks up as described here. Must be a bad driver.

f-liva commented 1 year ago

It also gives me this problem. wsl --shutdown does not work, terminal remains stuck on black screen, no output

The only way is to reboot the operating system

nico-is-coding commented 1 year ago

Hey @f-liva as a workaround try this one.

For me the problem may be fixed after updating to Windows 11 Version 22H2. No VmmemWSL hangs since a week 🤞

f-liva commented 1 year ago

It worked thank you!

Setitch commented 1 year ago

This error again appears - windows 10

Phil-Barker commented 1 year ago

Also happening here - lastest version of Windows 11, was fine up until about a week ago Now every time I wake my PC from sleep WSL won't respond to any commands. Have to do taskkill /f /im wslservice.exe and then restart everything and docker desktop.

Setitch commented 1 year ago

Restarted machine, and... already wsl is hungin on every command, using 30% cpu constantly

jaspritsingh16 commented 1 year ago

For wsl2 try:

on CMD with admin access:

` taskkill /F /FI "IMAGENAME -eq wsl.exe"

taskkill /F /FI "IMAGENAME -eq wslhost.exe"

taskkill /F /FI "IMAGENAME -eq wslservice.exe" `

jamiematrix commented 1 year ago

For wsl2 try:

on CMD with admin access:

` taskkill /F /FI "IMAGENAME -eq wsl.exe"

taskkill /F /FI "IMAGENAME -eq wslhost.exe"

taskkill /F /FI "IMAGENAME -eq wslservice.exe" `

This worked for me.

Running taskkill /f /im wslservice.exe would complete but not help with resizing the VHD, the optimize command would say the disk is still in use despite wsl --list --verbose saying Ubuntu wasn't running.

SonGokussj4 commented 1 year ago

Facing same issues, Couldn't end process (vmmem) from task manager, it says access denied, also powershell command to taskkill also says process not found.

Same problem. It's running under a different user . Some kind of 036A94A8-1418-9295-A028AEFF305F So I can't kill it even from Admin prompt / Admin Task Manager

taskkill /f /im wslservice.exe helped

$ 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.19045.2604
Izet0004 commented 1 year ago

This issue still exists, it surprises me a issue affecting so many people is closed..

Same here @ddonov, when docker desktop is running and notebook awakes from sleep.

My workaround is to kill the wslservice.exe in a admin powershell: taskkill /f /im wslservice.exe

Thanks for the command, now we are running this command instead of rebooting all the time

ks2k2d commented 1 year ago

https://github.com/microsoft/WSL/issues/9758

benhillis commented 1 year ago

Update here - we have identified a couple of causes of the vmmem process geting into this state (which also causes the wslservice executable to stop responding). Unfortunately, these issues are in the Windows OS, so we're working through the process of backporting the fixes.

hanzlahabib commented 1 year ago

It's been months, I am facing same issue, when laptop goes sleep and come back then this issue start appearing

drekinov commented 1 year ago

follow up because i wrote some time ago. my issue disappeared 2 days ago. i did not have CPU issue but each sleep / hibernate lead to WSL2 to become not responsive. kill command was workaround + keeping laptop in presentation mode while in office (short breaks; 3 minutes timeouts for sleep as most green option in windows 11).

so it just stopped. might be latest windows patches / updates. however that come with another issue which was fixed. time in wsl2 / ubuntu is paused and not synced after sleep. after wake i should run sudo hwclock -s. that is an issue with JWT tokens and etc. it was fixed long time ago via kernel update.

i hope other people got the fix too but check your time in wsl2 :)