ExplorerPatcher icon indicating copy to clipboard operation
ExplorerPatcher copied to clipboard

WebView2 CPU Usage Issue from Weather Widget

Open HenryTheVacuum opened this issue 1 year ago • 50 comments

When using the Weather Widget on the taskbar, Microsoft's Edge WebView2 service will glitch/hang and use like 15% CPU consistently which leaves my laptop's processor running at 95 degrees.

There are several processes under COM Surrogate in the task manager that support the widget (Several WebView2 services).

Ending or restarting the widget fixes the issue, however I'm not sure what causes it as it takes several hours for the issue to come up again.

I have changed the update frequency to every minute to see if I can catch something sooner that might be triggering the constant CPU usage.

HenryTheVacuum avatar Apr 10 '23 16:04 HenryTheVacuum

weather_hangs

So it appears sometimes after resuming from sleep, the program hangs when trying to reconnect? Although you can't see it in the screen shot, the contents of the box flickers like crazy which likely is causing the CPU to hang.

Could also be something to do with the DPI scaling as the box content is oversized and is trying to use the laptop screen scaling instead of transitioning to the external monitor.

HenryTheVacuum avatar Apr 12 '23 14:04 HenryTheVacuum

I've experienced something similar, tried to debug it, and eventually just gave up and disabled the weather widget. Basic details are as follows:

After resuming from sleep overnight, the laptop started to heat up. Task manager showed that the widget was running 30% CPU (on a 12-core system; so 100% on 3+ cores) and had around 4GB of private bytes in memory. Most likely whatever was going wrong was mired in javascript.

Reproducing the effect on demand is practically impossible; sleeping the device and resuming after a minute or two won't do it. My guess is that there's an interaction between the outdated state of the application host and some update on the remote website that happens during sleep.

One possible solution might be to completely drop and reload the weather host after resuming from sleep. The fact that it had managed to run up 4GB of memory usage suggests that periodically starting over is a warranted feature anyway.

Obviously the "correct" solution would be fetching the weather data from an API and displaying it locally so you actually get to control your runtime (and don't incur a 400MB memory penalty under even the best of circumstances). But heaven knows I don't feel like writing it. So I totally get why showing someone else's webpage is where this goes.

tylerl avatar Jun 07 '23 16:06 tylerl

If this is happening to you and you have a laptop, check if it has modern stand by. It might be related to this. Is your battery low in power when this also happens?

pyrates999 avatar Jun 08 '23 08:06 pyrates999

same thing happening for me, weather widget keep consuming 15~30% cpu usage forever, so I had to disable the weather widget.

Process name WebView2: weather - Google Search under COM Surrogate showing 15~30% CPU usage forever.

Killing the process works for few hours, but it starts again after few hours.

harimgs avatar Jun 15 '23 18:06 harimgs

If this is happening to you and you have a laptop, check if it has modern stand by. It might be related to this. Is your battery low in power when this also happens?

It's indeed related. It only happens for me in a laptop which only has a S3 standby. With a Modern Standby laptop it works normally. It doesn't matter if you are on a battery or plugged in.

Bec-de-Xorbin avatar Oct 31 '23 17:10 Bec-de-Xorbin

image Can confirm. 22621.2506

Amrsatrio avatar Nov 09 '23 03:11 Amrsatrio

Since you're running a preview update, please install the latest pre-release version of EP.

pyrates999 avatar Nov 09 '23 10:11 pyrates999

I have the latest everything even my unreleased changes......... 🤦

Amrsatrio avatar Nov 09 '23 16:11 Amrsatrio

same on W11 22621.2428 EP 22621.2428.59.1

aemsx avatar Nov 10 '23 09:11 aemsx

same for me on W11 22631.2861 (ExplorerPatcher 22621.2506.60.1)

twistios avatar Dec 14 '23 13:12 twistios

Also happens when coming out of S4 hibernation overnight

GammaScorpii avatar Jan 02 '24 22:01 GammaScorpii

Similar effect here, using latest version of EP. Low CPU usage after weather widget loaded. But when clicking the mouse inside a certain widget area, CPU load rises dramatically. CPU load won't go down until restarting EP or disable and then again enable weather option in EP. Clicking anywhere outside the marked area does no harm. See attached screenshots.

before_clicking area after_clicking

alex7654 avatar Jan 20 '24 15:01 alex7654

Same issue for me as well

egorbunovs avatar Jan 24 '24 18:01 egorbunovs

If this is happening to you, please include the following:

  1. windows version and build number. You can find this by running winver.
  2. EP version. Open up the EP properties application and go to about to find it.

pyrates999 avatar Jan 25 '24 08:01 pyrates999

Sorry, I should have included it in my comment. Here is the information requested: grafik grafik

alex7654 avatar Jan 25 '24 09:01 alex7654

Thank you.

pyrates999 avatar Jan 25 '24 09:01 pyrates999

I have the same issue with EP when resuming from sleep or hibernation on my laptop, except that COM Surrogate & child processes use about 30-35% of CPU.

Restarting File Explorer (using the link in bottom left of EP options menu) solves the CPU usage issue until the laptop goes to sleep / resumes, then the issue manifests itself again.

I am running W11 23H2, build 22631.3085 with EP 226212.2861.62.2.

lucspe avatar Jan 25 '24 09:01 lucspe

I'm having the same issue on my DESKTOP. I do not use sleep mode and leave my PC on 24/7. The only thing that turns off is my monitor.

EP 22621.2428.59.1 W11 Pro 22H2 22621.3007

Jaxel avatar Feb 01 '24 12:02 Jaxel

I'm having the same issue on my DESKTOP. I do not use sleep mode and leave my PC on 24/7. The only thing that turns off is my monitor.

EP 22621.2428.59.1 W11 Pro 22H2 22621.3007

Please update EP: https://github.com/valinet/ExplorerPatcher/releases/tag/22621.2861.62.2_9b68cc0

pyrates999 avatar Feb 01 '24 12:02 pyrates999

I'm having the same issue on my DESKTOP. I do not use sleep mode and leave my PC on 24/7. The only thing that turns off is my monitor. EP 22621.2428.59.1 W11 Pro 22H2 22621.3007

Please update EP: https://github.com/valinet/ExplorerPatcher/releases/tag/22621.2861.62.2_9b68cc0

After updating the issue still persists.

Jaxel avatar Feb 02 '24 11:02 Jaxel

Ok, thanks. Please wait for a developer to respond.

pyrates999 avatar Feb 04 '24 08:02 pyrates999

I don't see anyone here claiming this is happening on Windows 10, so I'd like to say that this is indeed happening to me on Windows 10:

image

God-damnit-all avatar Feb 15 '24 17:02 God-damnit-all

Even after upgrading everything, the issue still persists. I notice it because occasionally I will hear my PC fans raging, even while I am not even at my computer. So I go check it out and see the weather widget is the problem.

I ended up completely disabling the weather widget.

Jaxel avatar Feb 15 '24 17:02 Jaxel

Even after upgrading everything, the issue still persists. I notice it because occasionally I will hear my PC fans raging, even while I am not even at my computer. So I go check it out and see the weather widget is the problem.

I ended up completely disabling the weather widget.

If I had to guess, this is probably happening due to a callback leak.

God-damnit-all avatar Feb 15 '24 17:02 God-damnit-all

Just now I (again) got a very similar problem. Instead of soon after hibernation it happend "randomly" about ~20 minutes after returning from hibernation. I walked away from my machine and when I came back I could here the fans spinning fast so I immediatly knew what was happening. It was still COM Surrogate but this time it was not the weather but the "gpu process". Not only did it cause a high cpu utilisation but also "ate" my RAM away.

Command line arguments of two most hungry processes:

"C:\Program Files (x86)\Microsoft\EdgeWebView\Application\121.0.2277.112\msedgewebview2.exe" --type=gpu-process --noerrdialogs --user-data-dir="C:\Users\user\AppData\Roaming\ExplorerPatcher\ep_weather_host\EBWebView" --webview-exe-name=DllHost.exe --webview-exe-version=10.0.22621.1 --embedded-browser-webview=1 --embedded-browser-webview-dpi-awareness=2 --no-appcompat-clear --gpu-preferences=WAAAAAAAAADgAAAMAAAAAAAAAAAAAAAAAABgAAAAAAA4AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAYAAAAAAAAAAgAAAAAAAAACAAAAAAAAAAIAAAAAAAAAA== --mojo-platform-channel-handle=2092 --field-trial-handle=2080,i,8537857491189957101,15380455410726052139,262144 --enable-features=MojoIpcz,msSingleSignOnOSForPrimaryAccountIsShared --variations-seed-version /prefetch:2 /pfhostedapp:1e9f6608ee9db5c89957a60288a87d7536191c35
"C:\Program Files (x86)\Microsoft\EdgeWebView\Application\121.0.2277.112\msedgewebview2.exe" --type=renderer --noerrdialogs --user-data-dir="C:\Users\user\AppData\Roaming\ExplorerPatcher\ep_weather_host\EBWebView" --webview-exe-name=DllHost.exe --webview-exe-version=10.0.22621.1 --embedded-browser-webview=1 --embedded-browser-webview-dpi-awareness=2 --allow-insecure-localhost --no-appcompat-clear --lang=en-US --device-scale-factor=1.25 --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=11 --js-flags="--harmony-weak-refs-with-cleanup-some --expose-gc --ms-user-locale=" --time-ticks-at-unix-epoch=-1707948004568474 --launch-time-ticks=134328812311 --mojo-platform-channel-handle=4968 --field-trial-handle=2080,i,8537857491189957101,15380455410726052139,262144 --enable-features=MojoIpcz,msSingleSignOnOSForPrimaryAccountIsShared --variations-seed-version /pfhostedapp:1e9f6608ee9db5c89957a60288a87d7536191c35 /prefetch:1

explorer_patcher_high_cpu_ram This is a picture that shows the COM surrogate utilisation of CPU and RAM.

I also created a dump of the two processes (each about >3GB). I could upload them but my network connection is very slow so it would take ages. Maybe I will try to analyse them myself.

twistios avatar Feb 16 '24 12:02 twistios

Similar effect here, using latest version of EP. Low CPU usage after weather widget loaded. But when clicking the mouse inside a certain widget area, CPU load rises dramatically. CPU load won't go down until restarting EP or disable and then again enable weather option in EP. Clicking anywhere outside the marked area does no harm. See attached screenshots.

before_clicking area after_clicking

EP Version 22621.3296.64.1 still does this. Clicking anywhere inside the weather display area will consume 10+% of the CPU until the weather COM process is End Task(ed).

USING: Windows 11 ver 22H2 (0S Build 22621.3296)

Beaverhoosen avatar Mar 15 '24 21:03 Beaverhoosen

I don't see anyone here claiming this is happening on Windows 10, so I'd like to say that this is indeed happening to me on Windows 10:

image

This also happens to me on windows 10. If I click on any graphic in the popup weather window, the cpu usage goes up. So I don't enable the weather feature in the taskbar.

pyrates999 avatar Mar 16 '24 09:03 pyrates999

Hey, EP 22621.3296.64.1, Win 11 Pro (ver 23H2 build 22631.3296) here, memory use goes to space even when widget is unclicked on the taskbar (up to 1.2gb ram out of 8gb), regardless if the widget is loaded or not (sometimes news is not switched to weather, dunno if it happens after standby or at other times as well).

Mayome avatar Mar 30 '24 13:03 Mayome

I updated to ExplorerPatcher version 22621.3296.64.1 and now CPU usage is absolutely normal, even when clicking into that certain areas. When the window is not opened, then there is no noticeable CPU usage at all.

This issue seems to be fixed, at least for my configuration and at this point in time.

This is my current Windows version: Windows 11 23H2 Build 22631.3296

alex7654 avatar Apr 11 '24 15:04 alex7654

Bad news: After waking the PC from sleep mode today, the CPU load was at roughly 75% soaked up by webview2. The weather widget flickered and displays something like "Connection lost afer sleep" (or similar).

After restarting Explorer Patcher, it works ok, but I guess it will throw the same issue tomorrow morning.

alex7654 avatar Apr 12 '24 05:04 alex7654