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

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

Open
1 of 2 tasks
dennisameling opened this issue Jun 19, 2022 · 326 comments
Open
1 of 2 tasks
Assignees
Labels

Comments

@dennisameling
Copy link

dennisameling commented Jun 19, 2022

Version

Microsoft Windows [Version 10.0.22621.160]

WSL Version

  • WSL 2
  • WSL 1

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

  • Start a WSL distro (Ubuntu 20.04)
  • See it hang
  • Try to do a wsl --shutdown
  • See that hang as well

image

Expected Behavior

  • Start a WSL distro (Ubuntu 20.04)
  • The command line should open

Actual Behavior

  • Start a WSL distro (Ubuntu 20.04)
  • The terminal hangs completely (see screenshot above)

Diagnostic Logs

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

@ghost ghost self-assigned this Jun 20, 2022
@mmichal3
Copy link

I have this issue as well. Killing the WSL process from taskmanager recovers, but it does it again. Especially (but not only) after it comes back from sleep.

@benhillis
Copy link
Member

Looks like something is wrong with your trace, could you please collect a trace using these instructions?
/logs

@ghost
Copy link

ghost commented Jun 28, 2022

Hello! Could you please provide more logs to help us better diagnose your issue?

To collect WSL logs, download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging

Thank you!

@benhillis
Copy link
Member

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

Thanks!

@ghost ghost closed this as completed Jul 5, 2022
@ghost
Copy link

ghost commented Jul 5, 2022

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you're still experiencing this issue please re-open it.

Thank you!

@berzi
Copy link

berzi commented Aug 25, 2022

I'm not the original poster, but I'm having a similar issue: every wsl command hangs (including wsl --shutdown), this causes problems with Docker, but because of the issues with WSL I can't even reinstall Docker itself (I initially thought it was a Docker issue but everything seems to point back to WSL).

wsl.exe dmesg also hangs so I can't post its output.

I attached the logs from collect-wsl-logs.ps1:

WslLogs-2022-08-25_08-34-21.zip

@CarlosRosuero
Copy link

Same problem here. Killing WSL from Task Manager solves the issue but is obviously not ideal.

@pontusvision
Copy link

Same here; this just started happening in the last few days; Please re-open this MSFT!

@georcon
Copy link

georcon commented Sep 17, 2022

Same here. Need to terminate the process from task manager. This issue started after updated WSL to the Store version.

@pernsdorff
Copy link

pernsdorff commented Sep 20, 2022

This should not have been closed - maybe the person went on vacation (7days?)
Happens often when attempting to switch folders using VSCode. Hangs -- generally just reboot to get back to working again for a while.

Heavy CPU from vmmemwsl

Windows ARM64
image

@rstepinski
Copy link

rstepinski commented Sep 20, 2022

Please reopen, this issue should not have been closed. This happens all the time, usually after waking the computer from sleep. Usually a simple wsl --shutdown worked after a ~30s wait, but today even this method failed as all wsl commands hang indefinitely. I need to go into task manager and shut down vmwp.exe, as otherwise the vmmem process persists even if I kill all wsl processes manually, and the wsl commands hang anyways.

This problem is really frustrating as it forces me to restart Docker and all containers, as well as my IDE, which with large projects can take some time.

@JPStrydom
Copy link

Please reopen, this issue should not have been closed. This happens all the time, usually after waking the computer from sleep. Usually a simple wsl --shutdown worked after a ~30s wait, but today even this method failed as all wsl commands hang indefinitely. I need to go into task manager and shut down vmwp.exe, as otherwise the vmmem process persists even if I kill all wsl processes manually, and the wsl commands hang anyways.

This problem is really frustrating as it forces me to restart Docker and all containers, as well as my IDE, which with large projects can take some time.

I was literally about to comment the same thing! This issues has been driving me CRAZY!!!

My wsl version is:

WSL version: 0.66.2.0
Kernel version: 5.15.57.1
WSLg version: 1.0.42
MSRDC version: 1.2.3401
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22000.978

Please can we reopen and address this?

@rstepinski
Copy link

Please reopen, this issue should not have been closed. This happens all the time, usually after waking the computer from sleep. Usually a simple wsl --shutdown worked after a ~30s wait, but today even this method failed as all wsl commands hang indefinitely. I need to go into task manager and shut down vmwp.exe, as otherwise the vmmem process persists even if I kill all wsl processes manually, and the wsl commands hang anyways.

This problem is really frustrating as it forces me to restart Docker and all containers, as well as my IDE, which with large projects can take some time.

What's worse, if this happens and I forget to close my IDE before terminating WSL, when I reopen the project everything needs to be reindexed. While the entire restart process takes seconds to do and I could live with this inconvenience, indexing can take minutes, which is not inconvenient - it's infuriating. It is simply unacceptable that this issue persists and I'm absolutely blown away that this seems to be ignored on purpose.

@ddonov
Copy link

ddonov commented Sep 30, 2022

Same issue here. After coming back from sleep Vmmem brings CPU usage to 100%
wsl --shutdown hangs. Happened 3 times in a row, reboot helps.
Tried killing vmwp.exe but it crashed the OS.
WSL version: 0.66.2.0 Kernel version: 5.15.57.1 WSLg version: 1.0.42 MSRDC version: 1.2.3401 Direct3D version: 1.606.4 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22000.978

@tricodon
Copy link

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

@indeed-a-genius
Copy link

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

ERROR: The process "wslservice.exe" not found

@Terryfeek
Copy link

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

This worked for me. Thanks a lot! Previously I would do a hard reset.

@nico-is-coding
Copy link

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

ERROR: The process "wslservice.exe" not found

did you start powershell as admin?

@indeed-a-genius
Copy link

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

ERROR: The process "wslservice.exe" not found

did you start powershell as admin?

yes

@ajohn25
Copy link

ajohn25 commented Oct 15, 2022

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

ERROR: The process "wslservice.exe" not found

This workaround doesn't work for me either but wsl --shutdown does (taking a minute or so to complete)

@niekvb
Copy link

niekvb commented Nov 10, 2022

@benhillis

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you're still experiencing this issue please re-open it.

Thank you!

This is some kind of joke, right?

@hanzlahabib
Copy link

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.

@Macmee
Copy link

Macmee commented Nov 13, 2022

+1 this issue occurs for me on a new SP9 SQ3 on 22H2 22621.755 in debian bullseye on WSL2 with the systemctl flag enabled in wslconfig.

WSL hangs when I stop a docker container. I then need to restart wsl but wsl --shutdown hangs.

only rebooting or taskkill /f /im wslservice.exe seems to fix it.

Issue should not be closed @craigloewen-msft hello friend can you help us? If there's anything I can do to share more info on how to reproduce please let me know. Thanks and big shoutout to you folks working on WSL, it TOTALLY ROCKS <3

@georcon
Copy link

georcon commented Nov 13, 2022

To all those affected here, as this is already closed.

I can't reproduce on my work laptop, but can reproduce on both my weak, 'personal' laptops.

Work machine has 64GB Ram and personal laptops have 16GB (Yeah, I know).

Worse when multiple instances of vscode are running under WSL. If everyone here has low-ish memory, this could be the culprit.

@craigloewen-msft
Copy link
Member

Hi folks, reopening this so it can be visible to the WSL team. It was closed automatically since we didn't get any feedback from the original author. Thanks for flagging us on it!

@fayora
Copy link

fayora commented Nov 17, 2022

PLEASE FIX WHATEVER IS CAUSING THIS!!! There are literally DOZENS of threads online about this issue, including several on this GitHub repo! All was good in Win10, now WSL goes zombie after a sleep/hybernate and it is not even clear how to bring it back without rebooting the WHOLE SYSTEM.

@scscgit
Copy link

scscgit commented Aug 5, 2024

@benhillis Can you maybe assign someone else to this task if you aren't working on it? And have you escalated it to someone like a manager yet, or are there any experts who understand the problem? Same for related issues like

@kaizh102
Copy link

kaizh102 commented Aug 9, 2024

updated to latest wsl prerelease. issue seems to be gone now.

@kaizh102
Copy link

kaizh102 commented Aug 9, 2024

updated to latest wsl prerelease. issue seems to be gone now.

I said that too early, issue still present.

@mujo93
Copy link

mujo93 commented Aug 13, 2024

I am having a freeze in Powershell after running wsl --shutdown command.
WslLogs-2024-08-13_21-21-25.zip

@RalfKow
Copy link

RalfKow commented Aug 14, 2024

Same problem here.

@timadye
Copy link

timadye commented Aug 14, 2024

I have been using the custom kernel that was mentioned by onereal7, following these instructions.

So far, after a month with the new kernel, I have not had another hang like the ones that previously plagued me every few days. I don't know if it really has fixed the issue, but it is very promising. I'm using Windows 10 22H2, WSL 2.2.4.0, with CentOS7 and Alma9 distros.

@faturachmanyusup
Copy link

faturachmanyusup commented Aug 27, 2024

wsl.exe dmesg

[    1.349572] clocksource: Switched to clocksource tsc
[    2.169143] misc dxg: dxgk: dxgkio_is_feature_enabled: Ioctl failed: -22
[    2.182711] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    2.183785] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    2.184162] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    2.184933] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2
[    2.187688] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    2.188421] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    2.189034] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    2.189466] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -22
[    2.189816] misc dxg: dxgk: dxgkio_query_adapter_info: Ioctl failed: -2

@oldbuilding
Copy link

WSLg apps will randomly freeze, and CANNOT be killed. When this happens wsl --shutdown is no long effective, and requires a full restart.

It's insanely frustrating, and wastes so much time every week.

I just posted this on a similar issue; hope it helps others.

function WslRestart { Get-Service LxssManager | Restart-Service }
function WslStop { Get-Service LxssManager | Stop-Service }

function WslStart { Get-Service LxssManager | Start-Service }

function WslServiceStatus {
	tasklist /svc /fi "imagename eq svchost.exe" | findstr LxssManager
	Get-Service | Where-Object { $_.name -like "*LxssManager*" }
	Get-CimInstance -ClassName Win32_Service -Filter "Name='LxssManager'"
}

function WslKill {
	Write-Host "Killing wsl.exe..."
	taskkill /F /FI "IMAGENAME eq wsl.exe"
	Write-Host "Killing wslhost.exe..."
	taskkill /F /FI "IMAGENAME eq wslhost.exe"
	Write-Host "Killing wslservice.exe..."
	taskkill /F /FI "IMAGENAME eq wslservice.exe"
}

WslForceRestart is the only thing that works for me. I have it in a powershell profile. Must be run as admin. WslStop and WslRestart are both useless functions. I'm including them here just to point out that they don't work for me. And wsl --shutdown has been useless for ... maybe the last year.

function WslForceRestart {
	WslKill
	WslStart
	WslServiceStatus
}

@renatodru
Copy link

I have the same problem, I tried everything, there is no command to kill or stop this process.
Fortunately I managed to suspend it and thus freed up the CPU, but it continues to consume 21GB of memory.
image

@sgombai
Copy link

sgombai commented Oct 4, 2024

So if I understand right, if you use this feature on MS's multiuser operating system, then the only solution that avoids restarting the whole OS is to be an administrator on that multiuser operating system.
In 2024.
And they don't handle it as prio 1.
And they don't say they're just kidding while selling this product.

@gianluca-sabena
Copy link

I have the same problem, WSL2 freeze! And wsl --shutdown doesn't work! I use only vscode, no WSLg apps...

@alexiglesias31
Copy link

Same issue here 😞

@bennycode
Copy link

I have the same problem, WSL2 freeze! And wsl --shutdown doesn't work! I use only vscode, no WSLg apps...

Does the command taskkill /f /im wslservice.exe work for you?

@luoye00
Copy link

luoye00 commented Oct 31, 2024

Same issue here from 2023 😞

@Addison-Reilly
Copy link

This issue still persists, and still makes developing on Windows completely impracticle for me. This really feels like it should be a higher priority given the push for better developer integration with windows at the moment.

@ricardo-s-ferreira-alb
Copy link

I’m facing the same issue. Everyone involved in development needs WSL in particular with java and docker images. Switching to Linux has been on my mind constantly.

@timadye
Copy link

timadye commented Nov 1, 2024

People who still see this problem: is it the same as discussed in this comment: #6982 (comment)? I applied the workaround mentioned there and earlier in this thread (#8529 (comment)) and have not since seen the problem after 4 months. I am using Windows 10 (that problem is supposed to be fixed in Windows 11 22H2) and WSL2 without Docker (I don't know if the workaround works with Docker).

The workaround involves installing a patched WSL2 kernel as described here. As you know, the WSL2 kernel is normally the same for all your distros, so it should work for all types (I use Alma9, and occasionally ancient versions CentOS7 and Ubuntu 20.04).

@gerardnico
Copy link

Just for the lost mind as me that did not understand what was going on.

wsl is just bash. Meaning that it may start login/interactive script such as bashrc and the like.
If you have a recursion, the CPU will hit the fan and you will not be able to login.

If this is the case, just try to start bash without any.

wsl.exe -e bash --norc

If it works, you got a recursion in your login/bashrc script.

@GhostDog98
Copy link

Still experiencing... Can't even begin to explain how disruptive this is to my workflow lol.

@bgigous
Copy link

bgigous commented Nov 15, 2024

Still experiencing... Can't even begin to explain how disruptive this is to my workflow lol.

@GhostDog98 I feel like we're kindred spirits right now. I literally just found this issue an hour after your comment to complain as well.

Restarting my whole machine just to get WSL to work is super irritating, which is often what I have to do. I haven't launched any VMs of any kind since my last machine restart and I have this issue. Maintainers, please make this a priority.

@kaizh102
Copy link

Still experiencing... Can't even begin to explain how disruptive this is to my workflow lol.

@GhostDog98 I feel like we're kindred spirits right now. I literally just found this issue an hour after your comment to complain as well.

Restarting my whole machine just to get WSL to work is super irritating, which is often what I have to do. I haven't launched any VMs of any kind since my last machine restart and I have this issue. Maintainers, please make this a priority.

try this command with Powershell:
taskkill /f /im wslservice.exe

@kaizh102
Copy link

Still experiencing... Can't even begin to explain how disruptive this is to my workflow lol.

@GhostDog98 I feel like we're kindred spirits right now. I literally just found this issue an hour after your comment to complain as well.

Restarting my whole machine just to get WSL to work is super irritating, which is often what I have to do. I haven't launched any VMs of any kind since my last machine restart and I have this issue. Maintainers, please make this a priority.

if you are willing to try, read this post, try a modified kernel. for me, bzImage-5.15.153.2-microsoft-standard-WSL2 link [here] worked.

@koriyyy
Copy link

koriyyy commented Nov 20, 2024

same issue and even taskkill /f /im wslservice.exe doesn't work for me... The issue was posted almost 3 years ago and no one fix it???

@GhostDog98
Copy link

Somewhat ironically... the only machine I am having this issue on... is a microsoft surface 🤦‍♀
M$FT can't even make this work with sleep on their own devices lol.

@hafidm93
Copy link

hafidm93 commented Nov 23, 2024

got same issue at the end of 2024

@mhofman
Copy link

mhofman commented Nov 25, 2024

People who still see this problem: is it the same as discussed in this comment: #6982 (comment)? I applied the workaround mentioned there and earlier in this thread (#8529 (comment)) and have not since seen the problem after 4 months. I am using Windows 10 (that problem is supposed to be fixed in Windows 11 22H2) and WSL2 without Docker (I don't know if the workaround works with Docker).

The workaround involves installing a patched WSL2 kernel as described here. As you know, the WSL2 kernel is normally the same for all your distros, so it should work for all types (I use Alma9, and occasionally ancient versions CentOS7 and Ubuntu 20.04).

This should be quoted as solution / workaround in the original report! It absolutely works. I had been suffering from hangs when sleeping / hibernating and using the patched kernel solved it. Anyone still reporting experiencing this issue, find your matching kernel with the patch and configure wsl2 to use it. If you're still having issues after that, it may be a separate problem.

@scscgit
Copy link

scscgit commented Dec 8, 2024

Too bad this isn't a solution for users who aren't willing to install an untrusted kernel binary build, provided by a random user, on their system :( Btw. @mhofman, you didn't report whether it also works with Docker.

@mhofman
Copy link

mhofman commented Dec 9, 2024

Docker works perfectly. I looked at how that binary was created, and it's the CI system that generated it from the original commit of the kernel that my version of Windows was using, with a single commit reverted, so I didn't bother recreating it.

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

No branches or pull requests