NEW194444
[WPE][GTK] Enable CPU limit
https://bugs.webkit.org/show_bug.cgi?id=194444
Summary [WPE][GTK] Enable CPU limit
Michael Catanzaro
Reported 2019-02-08 12:00:24 PST
We should consider moving the CPU limit support from WebProcessCocoa.mm into cross-platform code, and adding a new WEBKIT_WEB_PROCESS_EXCEEDED_CPU_LIMIT termination reason. Looks straightforward. The only hard part would be choosing the right limit. Cocoa makes it configurable via API, but I suspect a hardcoded limit would work better for WPE/GTK. It's not clear what that limit should be, though.
Attachments
Konstantin Tokarev
Comment 1 2019-04-11 07:35:28 PDT
If it's not clear what that limit should be, how can you hardcode it? It may be different for different kinds of applications or target systems
Jérémy Lal
Comment 2 2019-04-11 08:29:55 PDT
Seconded, i occasionally use webkitgtk for svg/dom SSR intensive tasks that can load cpu at 100% for several minutes with very high memory usage. Having limits that way is an important feature, but it's also important to be able to switch them off.
Michael Catanzaro
Comment 3 2019-04-11 09:12:37 PDT
Please understand the web process will be killed if the CPU limit is reached. So you'll have to make sure your web content does NOT trigger the limit. It won't be a friendly limit that just throttles you. Point is a web browser should not be executing CPU-intensive content for long as it could drain the user's battery life.
Konstantin Tokarev
Comment 4 2019-04-11 09:25:23 PDT
>Point is a web browser should not be executing CPU-intensive content for long as it could drain the user's battery life. Which is the last thing could I care about when my PC is plugged into AC network :)
Konstantin Tokarev
Comment 5 2019-04-11 09:28:47 PDT
What is actually important for users is blocking or at least detection of scripts which siltently do cryptomining in background
Konstantin Tokarev
Comment 6 2019-04-11 09:30:41 PDT
*for desktop users; embedded story is different, draining CPU here may make whole system unusable so it's often preferred to break misbehaving content in order to preserve stability
Carlos Alberto Lopez Perez
Comment 7 2025-07-04 15:07:28 PDT
I think is worth here checking which tab is active and if such tab is focused. A non-active tab should have a conservative CPU limit, and the active tab (if is not focused in the sense that is not showing on the screen because is behind another application or the browser is minimized) then maybe it should have a less conservative limit. But all of that seems to me like a policy that the browser should define rather than the web engine. So i guess that adding glib API calls that the browser embedding webkit can call to define the policy is the best option. By default everything unlimited, but give the options to configure limits.
Note You need to log in before you can comment on or make changes to this bug.