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

WSL2 causing high CPU load #7893

Closed
1 of 2 tasks
max06 opened this issue Jan 4, 2022 · 17 comments
Closed
1 of 2 tasks

WSL2 causing high CPU load #7893

max06 opened this issue Jan 4, 2022 · 17 comments

Comments

@max06
Copy link

max06 commented Jan 4, 2022

Version

Microsoft Windows [Version 10.0.22000.376]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.10.60.1

Distro Version

Ubuntu 18.04

Other Software

No response

Repro Steps

Unsure. Here it's enough to simply have a wsl2 shell open. Funny enough, it's gone for now.

Expected Behavior

Taskmanager showing Vmmem with little to no cpu usage in idle, while a wsl2 shell is open.

Actual Behavior

Taskmanager show(ed) Vmmem with 5-6% constant cpu usage (on a CPU with 32 Threads), high energy consumption and makes the task manager flicker every second.

Processes inside the WSL guest are idling:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0   1744  1080 ?        Sl   23:17   0:00 /init
root         7  0.0  0.0   1752    68 ?        Ss   23:17   0:00 /init
root         8  0.0  0.0   1752    76 ?        S    23:17   0:00  \_ /init
max06        9  0.0  0.0  22988  5000 pts/0    Ss   23:17   0:00      \_ -bash
max06       98  0.0  0.0  37804  3332 pts/0    R+   23:22   0:00          \_ ps xuaf

Closing the shell (and waiting some seconds) fixes the issue, as well as terminating the guest or the virtual machine.

Diagnostic Logs

I currently hope for someone coming along with "we know that already" and "it's gonna be fixt next update". Otherwise I'm happy to provide whatever you ask for.

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 12, 2022

Thanks for reporting this @max06.

I wonder if this could be caused by wslg.

Can you try to add:

[wsl2]
guiApplications=false

To %userprofile%.wslconfig , then run wsl --shutdown, and start wsl again to see if the issue is still there ?
Also, what's the output of dmesg ?

@ghost
Copy link

ghost commented Jan 19, 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!

@craig-matadeen
Copy link

Thanks for reporting this @max06.

I wonder if this could be caused by wslg.

Can you try to add:

[wsl2]
guiApplications=false

To %userprofile%.wslconfig , then run wsl --shutdown, and start wsl again to see if the issue is still there ? Also, what's the output of dmesg ?

I'm not sure if it's prudent replying here, but I just wanted you to know that your comment fixed a similar issue that I was having on a clean install of windows 11 where wsl was causing the taskbar notification icons and taskmanager to flicker a lot. Thanks mate.

@cmaart
Copy link

cmaart commented Feb 15, 2022

Thanks for reporting this @max06.
I wonder if this could be caused by wslg.
Can you try to add:

[wsl2]
guiApplications=false

To %userprofile%.wslconfig , then run wsl --shutdown, and start wsl again to see if the issue is still there ? Also, what's the output of dmesg ?

I'm not sure if it's prudent replying here, but I just wanted you to know that your comment fixed a similar issue that I was having on a clean install of windows 11 where wsl was causing the taskbar notification icons and taskmanager to flicker a lot. Thanks mate.

Having this exact issue as well. Docker using wsl2 starts flickering taskbar and windows after a while with text inputs losing focus. Always have to restart docker/wsl2 to fix it

@levrik
Copy link

levrik commented Mar 27, 2022

Also experiencing this issue on Windows 11. Disabling GUI applications fixed it for me as well.

@AndreasSummer
Copy link

Have the same problem, most of the time in an RDP Connection.

@levrik
Copy link

levrik commented Apr 20, 2022

The issue was gone for me after I updated my Intel graphics drivers to their latest version overriding the Dell-provided ones which were quite outdated.

@max06
Copy link
Author

max06 commented Apr 24, 2022

@OneBlue I'm so sorry for the late reply... the issue never appeared again, until just now.

Let's go step by step:

I noticed lags in UI intensive applications (Vivaldi, Bluestacks)
Taskmanager was visibly refreshing the views (all of them) every second, with a short white empty screen between each frame.

I closed all the suspect applications: Vivaldi, VSCode, Windows Terminal, no improvements.

I reopened Vivaldi to look for this issue. I also opened a fresh windows terminal (powershell) to shutdown the wsl2 instance. The flickering disappeared.

Trying to reproduce the issue: Opened a tab with my Ubuntu WSL2 instance in Windows terminal. Flickering is back. Also the WSL2 instance showed a memory consumption of around 2GB, increasing tendency.

Found the question about dmesg in this issue, executed it inside my ubuntu instance:

[   20.494750] weston[1140]: segfault at 7fec60021000 ip 00007feca331c673 sp 00007ffc3efe3d08 error 4 in libc-2.28.so[7feca31de000+14b000]
[   20.494757] Code: 0f 18 8e 00 01 00 00 0f 18 8e 40 01 00 00 0f 18 8e 80 01 00 00 0f 18 8e c0 01 00 00 c5 fe 6f 06 c5 fe 6f 4e 20 c5 fe 6f 56 40 <c5> fe 6f 5e 60 48 81 c6 80 00 00 00 48 81 ea 80 00 00 00 c5 fd e7
[   20.494763] potentially unexpected fatal signal 11.
[   20.494764] CPU: 28 PID: 1140 Comm: weston Not tainted 5.10.102.1-microsoft-standard-WSL2 #1
[   20.494770] RIP: 0033:0x7feca331c673
[   20.494772] Code: 0f 18 8e 00 01 00 00 0f 18 8e 40 01 00 00 0f 18 8e 80 01 00 00 0f 18 8e c0 01 00 00 c5 fe 6f 06 c5 fe 6f 4e 20 c5 fe 6f 56 40 <c5> fe 6f 5e 60 48 81 c6 80 00 00 00 48 81 ea 80 00 00 00 c5 fd e7
[   20.494774] RSP: 002b:00007ffc3efe3d08 EFLAGS: 00010286
[   20.494776] RAX: 00007fec5bffe01e RBX: 00005598eba89630 RCX: 00007fec5bffdff0
[   20.494778] RDX: fffffffffdfde070 RSI: 00007fec60020f92 RDI: 00007fec5e01ffa0
[   20.494779] RBP: 00007fec68000af0 R08: fffffffffffffffe R09: 0000000000000000
[   20.494780] R10: 00007fec5bffe010 R11: 00007fec5bffe01e R12: 00007fec5dfff010
[   20.494782] R13: 00000000018c04ae R14: 00007ffc3efe3d40 R15: 0000000000000000
[   20.494783] FS:  00007feca2949900 GS:  0000000000000000

repeating every 900ms.

Copied whole output. Noticed, my vscode was still running with one window, telling me it's taking longer to close. I can't tell if that window was connected to WSL before. Force closing it stopped the flickering, and I'm not able to reproduce it now again.

A fresh dmesg dump doesn't show the terminating weston anymore.

I can't tell if disabling the GUI extensions for WSL would improve anything here, but a connection to VSCode seems to be likely.

@ghost ghost removed the needs-author-feedback label Apr 24, 2022
@levrik
Copy link

levrik commented Apr 25, 2022

@max06 With that additional information, maybe you could re-open the issue so someone from MS could notice it?

@max06
Copy link
Author

max06 commented Apr 25, 2022

@levrik I'd love to, but I don't have the privileges for that...

@levrik
Copy link

levrik commented Apr 25, 2022

@max06 That's weird... I was guessing so from #7893 (comment).

@max06
Copy link
Author

max06 commented Apr 25, 2022

I hope @OneBlue can reopen it 😅

@OneBlue
Copy link
Collaborator

OneBlue commented Apr 26, 2022

Thanks for reporting this @max06. Based on the logs it looks like weston is crashing. If it's crashing in a loop that would explain the CPU consumption.

I'd recommend creating a wslg issue for this

@max06
Copy link
Author

max06 commented Apr 26, 2022

@OneBlue Thank you for your reply!

The more interesting question is: Why is weston even running when there's no GUI application using it? Thought it would get started on first use.

@OneBlue
Copy link
Collaborator

OneBlue commented Apr 26, 2022

It's always started when gui apps are enabled. There are no easy way to do that 'on-demand' since GUI apps will expect the X11 socket to be already present when they start

@max06
Copy link
Author

max06 commented Apr 26, 2022

Gotcha. Disabling weston would obviously solve this issue, but then I can't use gui apps (if I'd want to). Maybe remotely related: Is weston also used if I'm running a regular Hyper-V VM with Linux and the enhanced session mode?

@OneBlue
Copy link
Collaborator

OneBlue commented May 11, 2022

No, these two things are completely different.

This issue was closed.
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

6 participants