Closed Bug 919768 Opened 12 years ago Closed 12 years ago

Slowdown and OOM hit visiting top-sites in about:home

Categories

(Firefox for Android Graveyard :: Awesomescreen, defect)

27 Branch
ARM
Android
defect
Not set
major

Tracking

(firefox26 fixed, firefox27 verified, fennec26+)

VERIFIED FIXED
Firefox 27
Tracking Status
firefox26 --- fixed
firefox27 --- verified
fennec 26+ ---

People

(Reporter: aaronmt, Assigned: rnewman)

Details

(Keywords: perf, reproducible, Whiteboard: [qa+])

Attachments

(3 files, 1 obsolete file)

Currently I did a little experimenting on a fresh-profile opening about a dozen news article links off of http://hardocp.com on their front-page. I then began check on my top-sites and began pinning and unpinning all of the positions. In doing so the responsiveness and time it took to complete the action got slower and slower. Checking on log-cat revealed the following: -- I/dalvikvm(16918): "ModernAsyncTask #5" prio=5 tid=21 RUNNABLE I/dalvikvm(16918): | group="main" sCount=0 dsCount=0 obj=0x42276a40 self=0x72e12b48 I/dalvikvm(16918): | sysTid=17010 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1927032504 I/dalvikvm(16918): | state=R schedstat=( 0 0 0 ) utm=255 stm=24 core=0 I/dalvikvm(16918): at android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method) I/dalvikvm(16918): at android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:441) I/dalvikvm(16918): at org.mozilla.gecko.gfx.BitmapUtils.decodeByteArray(BitmapUtils.java:108) I/dalvikvm(16918): at org.mozilla.gecko.gfx.BitmapUtils.decodeByteArray(BitmapUtils.java:97) I/dalvikvm(16918): at org.mozilla.gecko.db.LocalBrowserDB.getFaviconForUrl(LocalBrowserDB.java:705) I/dalvikvm(16918): at org.mozilla.gecko.db.BrowserDB.getFaviconForUrl(BrowserDB.java:246) I/dalvikvm(16918): at org.mozilla.gecko.home.TopSitesPage$ThumbnailsLoader.loadInBackground(TopSitesPage.java:687) I/dalvikvm(16918): at org.mozilla.gecko.home.TopSitesPage$ThumbnailsLoader.loadInBackground(TopSitesPage.java:644) I/dalvikvm(16918): at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:240) I/dalvikvm(16918): at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:51) I/dalvikvm(16918): at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:40) I/dalvikvm(16918): at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:123) I/dalvikvm(16918): at java.util.concurrent.FutureTask.run(FutureTask.java:234) I/dalvikvm(16918): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) I/dalvikvm(16918): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) I/dalvikvm(16918): at java.lang.Thread.run(Thread.java:841) I/dalvikvm(16918): E/GeckoBitmapUtils(16918): decodeByteArray(bytes.length=157266, options= null) OOM! E/GeckoBitmapUtils(16918): java.lang.OutOfMemoryError E/GeckoBitmapUtils(16918): at android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method) E/GeckoBitmapUtils(16918): at android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:441) E/GeckoBitmapUtils(16918): at org.mozilla.gecko.gfx.BitmapUtils.decodeByteArray(BitmapUtils.java:108) E/GeckoBitmapUtils(16918): at org.mozilla.gecko.gfx.BitmapUtils.decodeByteArray(BitmapUtils.java:97) E/GeckoBitmapUtils(16918): at org.mozilla.gecko.db.LocalBrowserDB.getFaviconForUrl(LocalBrowserDB.java:705) E/GeckoBitmapUtils(16918): at org.mozilla.gecko.db.BrowserDB.getFaviconForUrl(BrowserDB.java:246) E/GeckoBitmapUtils(16918): at org.mozilla.gecko.home.TopSitesPage$ThumbnailsLoader.loadInBackground(TopSitesPage.java:687) E/GeckoBitmapUtils(16918): at org.mozilla.gecko.home.TopSitesPage$ThumbnailsLoader.loadInBackground(TopSitesPage.java:644) E/GeckoBitmapUtils(16918): at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:240) E/GeckoBitmapUtils(16918): at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:51) E/GeckoBitmapUtils(16918): at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:40) E/GeckoBitmapUtils(16918): at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:123) E/GeckoBitmapUtils(16918): at java.util.concurrent.FutureTask.run(FutureTask.java:234) E/GeckoBitmapUtils(16918): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) E/GeckoBitmapUtils(16918): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) E/GeckoBitmapUtils(16918): at java.lang.Thread.run(Thread.java:841) -- This is reproducible on my Samsung Galaxy SIV (Android 4.3) which shouldn't have any speed problems doing this simple task. Tested on Nightly (09/23)
Attachment #808823 - Attachment mime type: text/x-log → text/plain
Oh this also happens just by re-visiting about:home top-sites and not doing any pinning/unpinning when meeting the conditions that triggered this
Summary: Slowdown and OOM hit on unpinning and pinning top-sites → Slowdown and OOM hit visiting top-sites in about:home
reloading about:home
tracking-fennec: ? → 26+
Let me know if more is needed for this investigation.
https://rnewman.pastebin.mozilla.org/3173341 My log is telling me that rendering about:home is decoding thumbnails 16 times. That appears to be every page I've ever visited in this profile. And we OOM on every one.
I'm using an HTC One, which also should have no trouble with this. This really ought to trigger low-memory cleanup, right?
Severity: normal → major
Attached patch Proposed patch. v1 (obsolete) — Splinter Review
Wow, this is fast.
Assignee: sriram → rnewman
Attachment #812285 - Flags: review?
Adding a short-circuit.
Attachment #812285 - Attachment is obsolete: true
Attachment #812285 - Flags: review?
Attachment #812287 - Flags: review?
Attachment #812287 - Flags: review? → review?(sriram)
Comment on attachment 812287 [details] [diff] [review] Proposed patch. v2 Review of attachment 812287 [details] [diff] [review]: ----------------------------------------------------------------- Looks good. ::: mobile/android/base/home/TopSitesPage.java @@ +594,2 @@ > } > + Bundle bundle = new Bundle(); Newline before this line. @@ +640,3 @@ > try { > + while (cursor.moveToNext()) { > + String url = cursor.getString(cursor.getColumnIndexOrThrow(Thumbnails.URL)); I like your approach of storing the index in a variable. Please use it here as well. @@ +643,3 @@ > > + // This should never be null, but if it is... > + final byte[] b = cursor.getBlob(cursor.getColumnIndexOrThrow(Thumbnails.DATA)); ditto. @@ +646,5 @@ > + if (b == null) { > + continue; > + } > + > + final Bitmap bitmap = BitmapUtils.decodeByteArray(b); We should probably be catching OOM in BitmapUtils. But I am fine with this approach too.
Attachment #812287 - Flags: review?(sriram) → review+
Gonna scope-creep this to fix a strictmode warning that seems to be wiping the first thumbnail shortly after redisplay. This might end up fixing Bug 922321, too.
I added some more commenting about the multi-load issue, and a couple of minor fixes. https://hg.mozilla.org/integration/fx-team/rev/132dbcea6676
Whiteboard: [fixed in fx-team][qa+]
Target Milestone: --- → Firefox 27
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [fixed in fx-team][qa+] → [qa+]
Please get this on Aurora!
Status: RESOLVED → VERIFIED
Comment on attachment 812287 [details] [diff] [review] Proposed patch. v2 [Approval Request Comment] Bug caused by (feature/regressing bug #): about:home rewrite (fig). User impact if declined: Much slower rendering of about:home (including background OOMs) for users with more than six visited sites. Testing completed (on m-c, etc.): Just landed on m-c. Tested on own device. Waiting for some feedback from next Nightly. Risk to taking this patch (and alternatives if risky): Should be slim: trivial DB access improvement, safe logic cleanup, and limiting an iteration. String or IDL/UUID changes made by this patch: None.
Attachment #812287 - Flags: approval-mozilla-aurora?
(In reply to Richard Newman [:rnewman] from comment #14) > Testing completed (on m-c, etc.): > Just landed on m-c. Tested on own device. Waiting for some feedback from > next Nightly. Can you loop back on how the feedback results were after landing to Nightly before we consider this for uplift?
Flags: needinfo?(rnewman)
Have heard zero negative feedback and seen no problems in Nightly on my own device. No evidence of test instability. :thumbsup:
Flags: needinfo?(rnewman)
Attachment #812287 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: