High CPU. network traffic and memory usage when open Newtab page if you have opened / bookmarked a problematic/ huge game page in the past

VERIFIED FIXED in Firefox 61

Status

()

P1
major
VERIFIED FIXED
a year ago
4 months ago

People

(Reporter: alice0775, Assigned: Mardak)

Tracking

(Blocks: 3 bugs, 5 keywords)

Trunk
Firefox 61
Unspecified
Windows 10
memory-footprint, qawanted, regression, reproducible, ux-error-recovery
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox-esr52 wontfix, firefox54 wontfix, firefox55 wontfix, firefox56 wontfix, firefox57 wontfix, firefox58 wontfix, firefox59 wontfix, firefox60 wontfix, firefox61 verified, firefox62 verified)

Details

(Whiteboard: [thumbnails], URL)

Attachments

(5 attachments)

(Reporter)

Description

a year ago
Created attachment 8889875 [details]
hang.html

Reproducible:  always

Steps To Reproduce:
0. Start with new profile
1. Open attached html and wait until the tab loading circle turns green
2. Exit browser and restart
3. Open Newtab Page (click [+] button)
   ---- observe CPU and Memory usage

Actual Results:
Even if there are about:home and Newtab page, browser consumes High CPU and memory.

Expected Results:
Very low CPU and memory usage.



WORKAROUND:
browser.newtabpage.enabled = false
and
browser.newtabpage.activity-stream.enabled = false (if activity-stream enabled)
(Reporter)

Updated

a year ago
Summary: High CPU and memory usage when open Newtab → High CPU and memory usage when open Newtab page
(Reporter)

Updated

a year ago
Blocks: 1383489
(Reporter)

Comment 1

a year ago
Another sample page attachment 8889630 [details]
Summary: High CPU and memory usage when open Newtab page → High CPU and memory usage when open Newtab page if you have opened a problematic page in the past
(Reporter)

Comment 3

a year ago
Regression window:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=5ceea82a79c7&tochange=2983ca6d4d1a

Regressed by:
Bug 870100 - Use BackgroundPageThumbs to capture user top sites that we don't currently capture

Mark Hammond [:markh],
Your patch trigger the problem. Could you look this?
Blocks: 870100
Flags: needinfo?(markh)
Keywords: footprint, regression
We attempt to thumbnail pages, and yeah, if those pages manage to chew lots of CPU or memory, then the thumbnailer will too - while it's done in a content process, it will still be noticeable. Ideally we'd be able to use a sandbox and limit the memory and CPU used, but I'm not aware if that's possible yet.
Flags: needinfo?(markh)
status-firefox55: affected → wontfix
status-firefox56: affected → wontfix
status-firefox57: --- → wontfix
Priority: -- → P3
(Reporter)

Comment 5

9 months ago
Still happen. Reproduce easily.

If you encounter this problem at least once, you can not solve it except by destroy the user profile

Steps To Reproduce:
0. Start with new profile
1. Open attachment 8950552 [details] and wait for a while
2. Exit browser(kill all nightly process) and restart browser
3. Open Newtab Page (click [+] button)
   ---- observe CPU and Memory usage
status-firefox58: --- → wontfix
status-firefox59: --- → fix-optional
status-firefox60: --- → affected
(Reporter)

Comment 6

9 months ago
Now, Bug 1433324 has been landed in m-c,
No longer available workaround....
Blocks: 1433324
(Assignee)

Comment 7

9 months ago
If it's caused by thumbnailing a top site, does browser.newtabpage.activity-stream.showTopSites=false avoid the problematic site?
(Reporter)

Comment 8

9 months ago
(In reply to Ed Lee :Mardak from comment #7)
> If it's caused by thumbnailing a top site, does
> browser.newtabpage.activity-stream.showTopSites=false avoid the problematic
> site?

I can still reproduce :(
(Assignee)

Comment 9

9 months ago
Oops sorry, can you also try setting browser.newtabpage.activity-stream.feeds.topsites=false ?
(Reporter)

Comment 10

9 months ago
(In reply to Ed Lee :Mardak from comment #9)
> Oops sorry, can you also try setting
> browser.newtabpage.activity-stream.feeds.topsites=false ?

confirmed. 
Setting the browser.newtabpage.activity-stream.feeds.topsites=false fixes the problem.
(Reporter)

Comment 11

9 months ago
"Refresh Firefox" would not fix the problem.



It is wrong to try to load the page again without user permission when opening "New Tab".
I think the logic of making thumbnails is wrong. 
Seems a security issue.
Component: New Tab Page → Activity Streams: Newtab
(Reporter)

Updated

9 months ago
Keywords: ux-error-recovery
(Reporter)

Comment 12

9 months ago
This page is also affected.
http://mzl.la/webassemblydemo

So, this bug is affected not only for a problematic page but also some game page.


I think that the thumbnail should be disabled until this bug is fixed. Because there are no way to fix the problem except about:config hack.


I will raise the importance of this bug.
Add "qawanted", this is very bad experiences. It impairs the reliability of the product.
Severity: normal → major
Keywords: qawanted
Summary: High CPU and memory usage when open Newtab page if you have opened a problematic page in the past → High CPU. network traffic and memory usage when open Newtab page if you have opened a problematic/ huge game page in the past
(Reporter)

Updated

9 months ago
Whiteboard: [this is very bad experiences. It impairs the reliability of the product]
(Reporter)

Comment 13

9 months ago
This page is also affected.
http://www.squarefree.com/bug523950/523950.gif
(Assignee)

Updated

9 months ago
Whiteboard: [this is very bad experiences. It impairs the reliability of the product] → [thumbnails]
A partial fix would be to have a static "blank image" and use this whenever BackgroundPageThumbs gets a timeout capturing the page - that should mean the problem happens when the thumbnail is missing, then will not happen again until the thumbnail expires. Not a perfect fix, but possibly a good enough start.
(Assignee)

Comment 15

9 months ago
(In reply to Mark Hammond [:markh] from comment #14)
> A partial fix would be to have a static "blank image" and use this whenever
> BackgroundPageThumbs gets a timeout capturing the page
Oh, that's an interesting "fix." We run into the recurring high CPU problem because we don't persist across restart failed thumbnails. We've previously had a temporary blacklist for twitch in bug 1412505, but that got reverted when the video error issue got fixed. But in general, there will be ways that loading pages will use up a lot of resources via javascript, large files, etc; and there won't really be ways to detect if even loading a page will be "bad" ahead of time.

So markh's suggestion is basically a dynamic blacklist implemented through the existing thumbnail storage mechanism so there doesn't need to be that much additional logic…

The main downside is what if the page actually becomes thumbnailable? Perhaps unlikely and oh well?
See Also: → bug 1412505
(In reply to Ed Lee :Mardak from comment #15)
> The main downside is what if the page actually becomes thumbnailable?
> Perhaps unlikely and oh well?

I believe thumbnails expire after 2 days - so I think the biggest downside is that we are likely to hit this that often, which might not appear like a "fix" at all.
(Assignee)

Updated

8 months ago
Duplicate of this bug: 1435704
(Assignee)

Comment 18

8 months ago
(In reply to Mark Hammond [:markh] from comment #16)
> I believe thumbnails expire after 2 days
I think we can avoid the expiration with our explicit requests to not expire them.

https://github.com/mozilla/activity-stream/blob/e1ae13a2398f4702d71a0d5b03487618544f104c/system-addon/lib/TopSitesFeed.jsm#L70-L72
Blocks: 1437659
Iteration: --- → 61.1 - Mar 26
Summary: High CPU. network traffic and memory usage when open Newtab page if you have opened a problematic/ huge game page in the past → High CPU. network traffic and memory usage when open Newtab page if you have opened / bookmarked a problematic/ huge game page in the past
(Assignee)

Comment 19

8 months ago
Created attachment 8957295 [details]
top site after storing empty

A quick hack and adding a top site of attachment 8948365 [details] seems to result in a white thumbnail with a 0-size file c3bb58cac6c9e281db3ca33867e4829f.png And restarting results in no new request and top site shows a white image (attached) and no more error messages in console after restarting.

```diff
diff --git a/toolkit/components/thumbnails/BackgroundPageThumbs.jsm b/toolkit/components/thumbnails/BackgroundPageThumbs.jsm
index 91063d9e9a28..c6313403c106 100644
--- a/toolkit/components/thumbnails/BackgroundPageThumbs.jsm
+++ b/toolkit/components/thumbnails/BackgroundPageThumbs.jsm
@@ -518,12 +518,14 @@ Capture.prototype = {
         Services.obs.notifyObservers(null, "clear-origin-attributes-data",
           JSON.stringify({ userContextId: privateIdentity.userContextId }));
       }
     };
 
+    // If this background attempt failed, cause a dummy file to be saved, so
+    // that gets loaded instead of attempting again (and again).
     if (!data) {
-      done();
+      PageThumbs._store(this.url, this.url, null, true).then(done, done);
       return;
     }
 
     PageThumbs._store(this.url, data.finalURL, data.imageData, true)
               .then(done, done);
```

Updated

8 months ago
Iteration: 61.1 - Mar 26 → ---
status-firefox61: --- → affected
Priority: P3 → --
(Assignee)

Updated

8 months ago
status-firefox60: affected → wontfix

Updated

8 months ago
Assignee: nobody → edilee
Priority: -- → P1
(Assignee)

Updated

8 months ago
Iteration: --- → 61.1 - Mar 26
(Assignee)

Updated

8 months ago
Blocks: 1445085
Blocks: 1406640

Comment 21

8 months ago
Commit pushed to master at https://github.com/mozilla/activity-stream

https://github.com/mozilla/activity-stream/commit/c41b4e5fbb38820666e5ff2f67f293233f0602ce
fix(screenshots): Store an empty screenshot to avoid repeatedly requesting failures (#4050)

Fix Bug 1384094 - High CPU. network traffic and memory usage when open Newtab page if you have opened / bookmarked a problematic/ huge game page in the past

Updated

8 months ago
Status: NEW → RESOLVED
Last Resolved: 8 months ago
Resolution: --- → FIXED

Comment 23

8 months ago
Commit pushed to master at https://github.com/mozilla/activity-stream

https://github.com/mozilla/activity-stream/commit/9632262414f4a99d2fbad56209927ed8df53e3df
Revert "Fix Bug 1384094 - High CPU. network traffic and memory usage when open Newtab page if you have opened / bookmarked a problematic/ huge game page in the past" (#4051)

This reverts commit c41b4e5fbb38820666e5ff2f67f293233f0602ce.
(Assignee)

Updated

8 months ago
Status: RESOLVED → REOPENED
Resolution: FIXED → ---

Comment 25

8 months ago
Commit pushed to master at https://github.com/mozilla/activity-stream

https://github.com/mozilla/activity-stream/commit/111ba085faa2d5b9685c79b7fa59b03f69555b17
fix(screenshots): Store an empty screenshot to return failure without repeat requests (#4052)

Fix Bug 1384094 - High CPU. network traffic and memory usage when open Newtab page if you have opened / bookmarked a problematic/ huge game page in the past

Updated

8 months ago
Status: REOPENED → RESOLVED
Last Resolved: 8 months ago8 months ago
Resolution: --- → FIXED
(Assignee)

Updated

8 months ago
Blocks: 1448443
(Assignee)

Comment 26

8 months ago
https://hg.mozilla.org/mozilla-central/rev/cf8982afa7df
status-firefox61: affected → fixed
Target Milestone: --- → Firefox 61
status-firefox59: fix-optional → wontfix
status-firefox-esr52: affected → wontfix
Flags: qe-verify+
This issue has been reproduced on Firefox 56.0a1 (2017-07-24) with the exact same repro steps as per described in both Comment 5 and Description of the ticket.

The issue was not reproduced however on Nightly 62.0a1 (2018-05-09) and Firefox 61.0b3 on a Windows 10x64 machine with the following hardware configuration: 16GB’s of RAM and 8CPU’s with ~3.5GhZ. 

Please see the below results for a more detailed overview of the CPU/Memory Usage: 


56.0.1 :

Default:                            ~7% CPU  / 35% Memory  
After(during) opening HTML attach:  ~20% CPU / 41% Memory
After restart+new Tab:              ~47% CPU / 56% Memory                


61.0b3 
Default:                            ~5%   CPU/ 33% Memory 
After(during) opening HTML attach:  ~17% CPU / 47% Memory
After restart+new Tab:              ~17% CPU /47% Memory


62.0a.1:

Default:                            ~5%  CPU / 33% Memory 
After(during) opening HTML attach:  ~17% CPU / 44% Memory
After restart+new Tab:              ~18 %CPU / 44%Memory 

Marking this issue as Verified-Fixed.
Status: RESOLVED → VERIFIED
status-firefox61: fixed → verified
status-firefox62: --- → verified
Flags: qe-verify+
Hello Ed, could you please take a look at the comment above and give us your input on the results provided? Are those percentages of CPU/Memory usages the intended ones? Thank you
Flags: needinfo?(edilee)
(Assignee)

Comment 29

6 months ago
Thanks for those numbers. Looks like CPU usage does avoid spiking after restart with the thumbnail fix.
Flags: needinfo?(edilee)

Comment 30

5 months ago
I'm still getting sky high CPU usage on 61.0b10, after a short while of idle time. 

If replace "thumbnailed" new page with the "blank" one, everything's good.

Comment 31

5 months ago
(In reply to mirh from comment #30)
> I'm still getting sky high CPU usage on 61.0b10, after a short while of idle
> time. 
> 
> If replace "thumbnailed" new page with the "blank" one, everything's good.

After b13 or b14, everything seems perfect. Sorry for the noise.

Updated

4 months ago
Duplicate of this bug: 1473344
You need to log in before you can comment on or make changes to this bug.