docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.85k stars 287 forks source link

High CPU usage while Docker Desktop is running on Windows #12266

Open wallyhall opened 2 years ago

wallyhall commented 2 years ago

Actual behavior

As per original issue:

High CPU usage on the Vmmem process while docker desktop is running 16% constant usage on CPU Intel(R) Core(TM) i9-9980HK CPU, aka 8 core machine Windows Task manager also reports "Very High" power usage from the process while Docker Desktop is running.

(I'm on a i7, but the symptoms remain very similar. "Idle" CPU usage can be anywhere from 15% to upward of 30% ... it seems to be higher after some containers have been running, even if they're then all stopped.)

Expected behavior

As per original issue:

No CPU activity when no containers are running

Information

Steps to reproduce the behavior

  1. Start Docker Desktop, and leave it idle with no containers running.

Following Poxmax's request to create a new issue.

The problem (in symptoms) as described under https://github.com/docker/for-win/issues/6947 still remains for me in Docker 4.1.0. I have no further information to add, the symptoms are identical - as far as I can tell it is precisely the same issue as was reported before and was closed after 90 days of inactivity.

I can confirm I am on version 4.1.0, using WSL2 (as described by others in the original issue).

I'm not a Docker Desktop power user - I don't know how to debug it - but if anyone (@Pomax for example) can guide me through any additional useful information I can provide, I'll happily try to oblige.

@wallyhall If you're going to unstale an issue, at least add more details, because you just pinging everyone with a "me too" for an issue that's basically moot. It'd be far better to file a new issue, with your new problem description, both so docker folks can look at it in relation to what Docker looks like now instead of several versions ago, and for all the people you just pinged.

Originally posted by @Pomax in https://github.com/docker/for-win/issues/6947#issuecomment-941089810

Just for the sake of saving people having to click back to an old ticket which was closed due to inactivity - I'm quoting the original issue (which precisely describes my experience). The only environmental differences I can see is I'm on Docker Desktop 4.1.0 (there were people discussing the issue on the old thread less than 6 months ago), and I happen to be on Windows 11 (but I was experiencing this issue before I upgraded from Windows 10).

wallyhall commented 2 years ago

Screenshot showing the issue I'm observing - the CPU usage goes away as soon as I quit Docker Desktop.

I've tried to upload another diagnostic capture (during this high CPU usage), but I get an error while uploading it (Internal Server Error). I've saved the report locally though, if anyone wants anything from it.

The CPU usage on this example was particularly high - causing significant lag on the machine.

image

vladimmi commented 2 years ago

https://github.com/docker/for-win/issues/2854 - 2018, stale, locked https://github.com/docker/for-win/issues/3811 - 2019, stale, locked https://github.com/docker/for-win/issues/4773 - 2019, stale, locked https://github.com/docker/for-win/issues/4977 - 2019, stale, locked https://github.com/docker/for-win/issues/6947 - 2020, stale, locked https://github.com/docker/for-win/issues/8742 - 2020 https://github.com/docker/for-win/issues/11378 - 2021, stale, locked now this one, silent

It seems devs expect it to disappear on its own at some time, otherwise I see no point in automatic closing of issues because that doesnt actually fix them.

jibbers42 commented 2 years ago

Shame I didn't get any coal for Christmas, I could have used it to help power my Vmmem...

ColinPM commented 2 years ago

Just started happening on my machine - funny enough it did not happen on Windows 10 but is happening on Windows 11. Using 1 core 100% of the time. Stopping a container doesn't stop it - only exiting the Docker Desktop application. I upgraded to 4.5.1 and that's when I noticed it. I saw the original earlier ticket and the advice to wallyhall to open a new ticket and then found his newer ticket. This is still an issue :-(

bill-finlay-ssd commented 2 years ago

I was experiencing this same issue on Windows 10 Pro: perpetual ~30% CPU utilization despite no containers running. I'm running Docker Desktop 4.5.1 (74721) currently but saw it happening on 4.5.0 earlier today and hoped that updating to 4.5.1 would fix it. It did not.

How I eventually fixed it: I disabled "Automatically check for updates" and manually closed and restarted Docker Desktop. Now Docker Desktop is utilizing around 0% to 1% CPU.

I hope this fixes the issue for others, too.

bn-s commented 2 years ago

I was experiencing this same issue on Windows 10 Pro: perpetual ~30% CPU utilization despite no containers running. I'm running Docker Desktop 4.5.1 (74721) currently but saw it happening on 4.5.0 earlier today and hoped that updating to 4.5.1 would fix it. It did not.

How I eventually fixed it: I disabled "Automatically check for updates" and manually closed and restarted Docker Desktop. Now Docker Desktop is utilizing around 0% to 1% CPU.

I hope this fixes the issue for others, too.

This works for me. Went from a constant ~20% CPU usage back down to <1%.

Information

Raton-Laveur commented 2 years ago

I was experiencing this same issue on Windows 10 Pro: perpetual ~30% CPU utilization despite no containers running. I'm running Docker Desktop 4.5.1 (74721) currently but saw it happening on 4.5.0 earlier today and hoped that updating to 4.5.1 would fix it. It did not.

How I eventually fixed it: I disabled "Automatically check for updates" and manually closed and restarted Docker Desktop. Now Docker Desktop is utilizing around 0% to 1% CPU.

I hope this fixes the issue for others, too.

Same behavior with 4.6.1, same fix still works.

b-hayes commented 2 years ago

I've been sitting here wondering why my laptop fan is screaming at me all day. I have containers running but nothing is actually happening they're just idling and my CPU was sitting at 34wt power draw. Close the docker decktop and it drops down and goes quiet.

Open docker with no containers running and the same result, CPU power jumps to 34wats temps jumps to 85degress and the fans ramp up again.

seeker commented 2 years ago

The issue is still present in Docker Desktop 4.7.0 (77141), workaround still works.

fernando2amigos commented 2 years ago

Windows 11 @ Docker desktop 4.7.1 (just updated) Exactly same behavior: from 40% CPU usage to 0% by disabling check for updates. C'mon, really!?!?

Before Screenshot 2022-04-20 114820

After (no even restarting Win; just exit & start Docker Desktop) Screenshot 2022-04-20 115957

vladimmi commented 2 years ago

Considering the facts that first such issue here was opened almost 4 years ago and lots of them were closed as stale, Docker devs have zero wish to fix anything. Whole issues functionality can be disabled on this repo as useless.

vash1486 commented 2 years ago

The issue is still present in Docker Desktop 4.7.0 (77141), workaround still works.

same for 4.7.1 (77678)

perclausen commented 2 years ago

Windows 11 @ Docker desktop 4.7.1 (just updated) Exactly same behavior: from 40% CPU usage to 0% by disabling check for updates. C'mon, really!?!?

Before Screenshot 2022-04-20 114820

After (no even restarting Win; just exit & start Docker Desktop) Screenshot 2022-04-20 115957

See the same on Windows 10, 25-30% CPU usage - did not help disabling automatic updates (have tried restarting PC). Docker version 4.7.1 (77678).

image

Same when paused... image

Firsh commented 2 years ago

For me too, on the latest version. The % is equal to 100/number-of-logical-processors by the way. Disabled updates, now fingers crossed that it'll stay near 0%.

perclausen commented 2 years ago

The disable updates workaround was not enough in my case but after a Reset to factory defaults CPU usage is down to 0-1% when idle.

image

enr1424 commented 2 years ago

The disable updates workaround was not enough in my case but after a Reset to factory defaults CPU usage is down to 0-1% when idle.

image

Same here, and the curious thing is that now CPU usage is down to 0 even with automatic updates enabled...

Mr1008 commented 2 years ago

Delete ~/.docker and check if it helps. Resetting and cleaning/purging did not help in my case but deleting this folder helped immediately

arturoarevalo commented 2 years ago

Deleting ~/.docker folder was the only solution that worked for me! Thanks @jmichalek-fp, this issue was driving me crazy as I am running Docker Desktop on a laptop and fans were mostly always on!

Firsh commented 2 years ago

I ended up uninstalling, then putting Docker inside WSL. Much better (and slimmer) experience. The GUI is now Portainer.

maffe commented 2 years ago

When this high CPU usage occured, I opened Process Explorer, checked the threads of Docker Desktop.exe and the one with the highest CPU usage often showed a FatalException in its stack. To me it looks like there is something failing and instead of cancelling it is tried over and over again.

Disabling automatic updates seems to fix it for me, too. Also happens with disabled automatic updates, without running containers.

Sample stacktraces:

Docker Desktop.exe!Cr_z_crc32+0x1c2392
Docker Desktop.exe!Cr_z_crc32+0xae534
Docker Desktop.exe!cppgc::internal::WriteBarrier::DijkstraMarkingBarrierRangeSlow+0x2f08b3
Docker Desktop.exe!cppgc::internal::WriteBarrier::DijkstraMarkingBarrierRangeSlow+0x2f43cb
Docker Desktop.exe!GetMainTargetServices+0x10c9ed9
Docker Desktop.exe!node::FatalException+0x1e0f22
Docker Desktop.exe!uv_fs_get_ptr+0x3aec4c
Docker Desktop.exe!GetMainTargetServices+0xb61ecf
Docker Desktop.exe!Cr_z_uncompress+0xde562
Docker Desktop.exe!node::FatalException+0x1e12ce
Docker Desktop.exe!cppgc::internal::WriteBarrier::DijkstraMarkingBarrierRangeSlow+0x2ea938
Docker Desktop.exe!Cr_z_crc32+0xaeb6a
Docker Desktop.exe!uv_sleep+0x42d83
Docker Desktop.exe!uv_sleep+0x4d33a
Docker Desktop.exe!uv_fs_get_ptr+0x4b7e45
Docker Desktop.exe!uv_mutex_destroy+0x15b372
Docker Desktop.exe!v8::SharedMemoryStatistics::read_only_space_size+0x28fa
Docker Desktop.exe!v8::Isolate::GetNumberOfDataSlots+0xaf1
Docker Desktop.exe!std::__1::vector<v8::CpuProfileDeoptFrame,std::__1::allocator<v8::CpuProfileDeoptFrame> >::begin+0x7611c
Docker Desktop.exe!std::__1::vector<v8::CpuProfileDeoptFrame,std::__1::allocator<v8::CpuProfileDeoptFrame> >::begin+0x768e4
Docker Desktop.exe!cppgc::SourceLocation::SourceLocation+0xb7ad
Docker Desktop.exe!Cr_z_crc32+0x4608a2
KERNEL32.DLL!BaseThreadInitThunk+0x14
ntdll.dll!RtlUserThreadStart+0x21
Docker Desktop.exe!cppgc::internal::WriteBarrier::DijkstraMarkingBarrierRangeSlow+0x2ff921
Docker Desktop.exe!v8::String::ExternalStringResourceBase::Dispose+0x80af7
Docker Desktop.exe!v8::String::ExternalStringResourceBase::Dispose+0x7ddb4
Docker Desktop.exe!Cr_z_uncompress+0xde225
Docker Desktop.exe!node::FatalException+0x1e12ce
Docker Desktop.exe!cppgc::internal::WriteBarrier::DijkstraMarkingBarrierRangeSlow+0x2ea938
Docker Desktop.exe!Cr_z_crc32+0xaeb6a
Docker Desktop.exe!uv_sleep+0x42d83
Docker Desktop.exe!uv_sleep+0x4d33a
Docker Desktop.exe!uv_fs_get_ptr+0x4b7e45
Docker Desktop.exe!uv_mutex_destroy+0x15b372
Docker Desktop.exe!v8::SharedMemoryStatistics::read_only_space_size+0x28fa
Docker Desktop.exe!v8::Isolate::GetNumberOfDataSlots+0xaf1
Docker Desktop.exe!std::__1::vector<v8::CpuProfileDeoptFrame,std::__1::allocator<v8::CpuProfileDeoptFrame> >::begin+0x7611c
Docker Desktop.exe!std::__1::vector<v8::CpuProfileDeoptFrame,std::__1::allocator<v8::CpuProfileDeoptFrame> >::begin+0x768e4
Docker Desktop.exe!cppgc::SourceLocation::SourceLocation+0xb7ad
Docker Desktop.exe!Cr_z_crc32+0x4608a2
KERNEL32.DLL!BaseThreadInitThunk+0x14
ntdll.dll!RtlUserThreadStart+0x21

The process with the high CPU usage uses only a small amount of RAM, about 10 MB.

briantist commented 2 years ago

Suddenly had this start happening today (no containers running) after upgrading to 4.7.1 (77678). I never experienced it before. Unchecking "Automatically check for updates" did not change anything for me.

Deleting ~/.docker (assuming in WSL?) also did not help for me.

wallyhall commented 2 years ago

Maybe the changes to the license agreement on Docker Desktop was to raise funds to fix this bug.

ahem

hacklschorsch commented 2 years ago

Disabling update checking didn't do it for me, and I also did not want to delete all my containers and volumes...

@maffe got me thinking with his writing:

To me it looks like there is something failing and instead of cancelling it is tried over and over again.

I had a couple of (shut down) Containers with a shared Volume in a folder that did not exist anymore. Maybe Docker was (re)trying to create the folder for that Volume in the now non-existing folder? I didn't need the containers any more (that's also why I had moved the Volume to some archive), and used this neat command line to remove all containers based on the common Image name.

Ever since my laptop has been quiet again, much to the relief of my office mates :)

TimGels commented 2 years ago

When I suspend the process with process explorer, it seems to "fix" the issue for me until I quit and launch docker desktop again (obviously). At least I am able to not have a turbine engine for the time being. afbeelding

Mr1008 commented 2 years ago

@TimGels please check if this helps https://github.com/docker/for-win/issues/12266#issuecomment-1112117020

daniel-liuzzi commented 2 years ago

I was having the same problem on latest Docker Desktop 4.7.1, tried every suggestion in this thread to no avail, but I did notice something: Pi-hole was blocking lots of requests to api.segment.io

Thinking it could be related, I disabled Pi-hole and restarted Docker Desktop. CPU usage dropped to ~2%. Re-enabled Pi-hole, restarted DD, CPU went up to ~30%. I consistently reproduced this behavior a few more times but now, weirdly enough, CPU usage is low even with Pi-hole enabled.

It would seem like DD was desperately attempting to upload telemetry data and failing, causing high CPU usage, but once it succeeded it finally settled down. Or so I would think.

TimGels commented 2 years ago

@TimGels please check if this helps #12266 (comment)

jmichalek-fp Is this inside the WSL? And does that delete my containers? I am currently in the middle of working on something and would rather not delete my containers if possible.

Mr1008 commented 2 years ago

@TimGels please check if this helps #12266 (comment)

jmichalek-fp Is this inside the WSL? And does that delete my containers? I am currently in the middle of working on something and would rather not delete my containers if possible.

No this is within your windows profile directory. It is a directory with docker contexts so you may or may not lose your data. I would do it with data backed up or when you are not in the middle of something.

Anyway this is the only thing that helped in my case.

TimGels commented 2 years ago

@TimGels please check if this helps #12266 (comment)

jmichalek-fp Is this inside the WSL? And does that delete my containers? I am currently in the middle of working on something and would rather not delete my containers if possible.

No this is within your windows profile directory. It is a directory with docker contexts so you may or may not lose your data. I would do it with data backed up or when you are not in the middle of something.

Anyway this is the only thing that helped in my case.

I will try it out sometime when I can. Thank you for the suggestion!

bayasdev commented 2 years ago

Disabling Automatically check for updates seems to fix the issue on my system (Windows 10 Pro 21H2), I launch containers from inside WSL2 (Ubuntu 20.04)

phucng commented 2 years ago

In my case (Docker Desktop 4.8.1 on Windows 11), only enabling Docker Extensions helps. The other methods, such as disabling auto-update or deleting ~/.docker, don't work.

mmarinchenko commented 2 years ago

Windows 10 Home 21H2 19044.1706 x64 Physical machine (AMD Zen2-based) Docker Desktop 4.8.1 (WSL2)

I can confirm the issue related to disabling the Docker Extensions option. Unfortunately, it leads to even worse consequences than just high CPU usage on idle: it constantly writes some data to disk, which eventually may kill SSD. It looks like the data is being transferred to a separate Docker Extensions process via pipe.

frederikhors commented 2 years ago

Same here. This is serious. I need to restart Docker for desktop many times during a day. And I'm using only one container (postgresql) with .wslconfig file like this:

[wsl2] memory=1GB

I'm on Windows 10 21H2 x64, Docker for desktop 4.7.1 77678, downgraded from 4.8.1 which is even worse.

PAXANDDOS commented 2 years ago

And same here. Docker Desktop CPU usage is more than 30% and my laptop sounds like one big fan... No such CPU usage for Vmmem tho. Windows 11 Home 10.0.22000 Build 22000 Docker Desktop 4.8.1 (and probably 4.7.1)

I had the same issue not long ago, on version 4.7.x I guess, but usually, it would go away if I restart Docker Desktop a few times. Now with version 4.8.1 it doesn't help anymore so I came here in search of help.

Finally, it went away after I clicked some buttons in settings. So I turned off Open Docker Dashboard at startup, Show weekly tips, and Send usage statistics on the General tab. Automatically check for updates on the Software Updates tab. And finally turned off Enable Docker Extensions on the Extensions tab, restarted, turned it back on, and restarted again.

Too many actions but I believe something from above has a connection to the issue 😅

frederikhors commented 2 years ago

@PAXANDDOS it will restart soon, unfortunately.

mmarinchenko commented 2 years ago

@PAXANDDOS

... turned off Enable Docker Extensions on the Extensions tab

This actually causes the latest issue. You should enable this option to work around the issue.

PAXANDDOS commented 2 years ago

@frederikhors Will it? So far it runs smoothly with no issues and restarts 🤷🏻‍♂️

@mmarinchenko Yeah, I think it's about the extensions feature too. I turned back on everything else I mentioned and it was fine

So I guess the final workaround is to turn off Enable Docker Extensions, restart, and turn it on again.

frederikhors commented 2 years ago

So far it runs smoothly with no issues and restarts

I HOPE! It bothered me these days and I "solved" it with a downgrade.

I guess the final workaround is to turn off Enable Docker Extensions, restart, and turn it on again

It re-start them again! Even with uncheck.

mmarinchenko commented 2 years ago

@PAXANDDOS

@mmarinchenko Yeah, I think it's about the extensions feature too. I turned back on everything else I mentioned and it was fine

So I guess the final workaround is to turn off Enable Docker Extensions, restart, and turn it on again.

In my case high CPU usage starts when system goes into idle state. So if I keep working after restarting DD, everything is fine. But if I go for a coffee, I'll have to restart DD again when I get back.

mat007 commented 2 years ago

The CPU spinning when the extensions are disabled has been fixed internally and will be released shortly (we’re preparing a Desktop 4.8.2).

I’ve been trying to reproduce the other problems based on the information I gathered from the comments in this issue. It seems they are at least two: one with the telemetry trying to re-send in a loop, and the other with the check for updates. I have tried everything I could think of, using a MITM proxy, my hosts file and my pi-hole, and I can’t reproduce.

Could someone experiencing any of the problems above create diagnostics and post back the ID once uploaded, please?

Thanks!

frederikhors commented 2 years ago

@mat007 thank you very much for your work.

Can you please tell us how to completely disable telemetry? https://github.com/docker/for-win/issues/12718

mmarinchenko commented 2 years ago

@mat007 thanks!

May the Force be with you!

bn-s commented 2 years ago

Thanks for looking into it @mat007

Here's my diagnostics ID: BB5BC696-66D0-4FC4-9BA0-38833238E33A/20220512154750


Edit: The diagnostics report I just uploaded was using an older version. I'd more or less abandoned Desktop (switched to just running Docker directly in WSL) after having the issue repeatedly return, despite attempting most fixes mentioned here. Curiously, I've since updated to 4.8.1 and the issue seems to have disappeared.

TimGels commented 2 years ago

It seems like the issue has been resolved on my end after updating to 4.8.1.

frederikhors commented 2 years ago

I have the issue with 4.8.1!

TimGels commented 2 years ago

I have the issue with 4.8.1!

Weird, it's almost like these are separate bugs internally then.

Edit: If the issue happens to me again, but with 4.8.1, I will mention it here with a diagnostics id.

dalisoft commented 2 years ago

Windows 10 Home 21H2 19044.1706 x64 Physical machine (AMD Zen2-based) Docker Desktop 4.8.1 (WSL2)

I can confirm the issue related to disabling the Docker Extensions option. Unfortunately, it leads to even worse consequences than just high CPU usage on idle: it constantly writes some data to disk, which eventually may kill SSD. It looks like the data is being transferred to a separate Docker Extensions process via pipe.

I don't know why need force users enable Docker Extensions by using more CPU when disabled but it's bad practice, sadly no other alternative found yet for Docker

lorenrh commented 2 years ago

We are preparing a 4.8.2 release. We have an RC Windows build prepared. Would you mind checking it out?

If the issue still persists, could you create diagnostics and post back the ID once uploaded, please?

mmarinchenko commented 2 years ago

@mat007 my Diagnostics ID: 45CA87B3-6E95-498F-AF6A-6AC118BC6686/20220513114622

DD consumes about 100% of 1 core and 50% of another one. It seems that most of the load is created inside some system call (the charts are mostly in bold - see attached screenshot).

DD version is 4.8.1 (see my https://github.com/docker/for-win/issues/12266#issuecomment-1123514988 above). Send usage statistics, Show weekly tips, and Automatically check for updates are DISABLED. Enable Docker Extensions is ENABLED.

I just booted up my machine, opened DD settings and clicked Check for updates button. Then I closed the DD Dashboard. Nothing else. I don't have any containers, images, or extensions installed. Fresh setup just after cleanup.

I also uploaded a process dump to OneDrive, feel free to analyze it: Docker Desktop.7z

Edit: I guess I actually clicked the Check for updates button several times. This may be important 🙂

Cores

aliaugmenta commented 2 years ago

Enabling Docker Extensions and Disabling Automatic Check for Updates fixed my cpu usage problem on Docker Desktop 4.8.1.