Closed Bug 1403109 Opened 7 years ago Closed 6 years ago

JS mining. Tool to limit CPU consuption

Categories

(Core :: DOM: Workers, enhancement, P3)

55 Branch
enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1513300

People

(Reporter: kes-kes, Unassigned)

References

(Depends on 1 open bug)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0 Build ID: 20170817115854 Steps to reproduce: Now days some sites embed script to do crypto mining. Because FF now provide multithreading it consume all 100% CPU and working on machine becomes toooo slow. Expected results: Please make auto detection of such scripts and limit them to 5%, for example, of CPU when something consume CPU 100% about 1 minute or more
Severity: normal → enhancement
Component: Untriaged → DOM: Content Processes
Product: Firefox → Core
We're discussing this sort of thing over in bug 1401628. My inclination is to fix it so at least the CPU is throttled for background tabs. Foreground tab throttling would be much harder to do without impacting legit workloads.
Status: UNCONFIRMED → NEW
Component: DOM: Content Processes → DOM: Workers
Depends on: 1401628
Ever confirmed: true
Priority: -- → P3
Just a little background regarding the recent "Mining explosion". We (Easylist Maintainers) and a number of other Anti-Mining scripts are trying to block the CPU usage by these miners. Currently we're at around 50 separate mining servers, and counting. I'd like an option would be warn a user a certain tab is using more CPU than normal? with an option to stop the related javascript/webasm/websocket's causing the excessive cpu usage. Without it a user could perceive that Firefox (or any browser) is just being slow/performing badly, especially if they keep that tab open then attempt to browse other sites.
I was also considering this as I've noticed recently a number of sites I use are now crypto-mining in the background. A possible solution could be to award each tab a number of "CPU time credits" (much like when renting a virtual machine). The idea being that after a tab loads it has a limited amount of credits representing CPU time, meaning that tabs that only have a legitimate amount of work (which should normally be a fixed amount at start) will be able to execute fully before the credits run out, but sites which continue to mine after the initial startup will begin to be heavily throttled. Additionally CPU time credits should accumulate slowly up to the limit with time, meaning that if a tab is idling in the background, and then a user switches to the tab and begins work, the tab will be able to execute its' tasks at full speed again until the credits run out.
An additional thought is that possibly a notification should be displayed in the SSL Green Bar Region when a tab exceeds its' CPU time credits, with an option for the user to disable the throttling if they choose. It might also be worth creating some kind of public white list for websites that have a large CPU time usage for legitimate reasons (Google Docs or such)
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.