Closed Bug 1861811 Opened 2 years ago Closed 2 years ago

Firefox hangs on start with many bookmarks in Other Bookmarks

Categories

(Firefox :: Bookmarks & History, defect)

Firefox 119
defect

Tracking

()

VERIFIED FIXED
122 Branch
Performance Impact ?
Tracking Status
firefox-esr115 --- unaffected
firefox120 --- wontfix
firefox121 --- verified
firefox122 --- verified

People

(Reporter: wgollino, Assigned: mak)

References

(Regression)

Details

(Keywords: perf, regression, Whiteboard: [sng][places-performance])

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0

Steps to reproduce:

I can reproduce by:

  1. Create a new profile
  2. Set the bookmarks toolbar to be visible
  3. Add 3000 bookmarks to "Other Bookmarks"
  4. Close Firefox
  5. Start Firefox - hangs for 10-15 seconds
  6. Open new window - hangs for 10-15 seconds again

Actual results:

Firefox is unresponsive for 10-15 seconds at startup and when creating a new window:

  1. Window is partially rendered
  2. User can't interact with any part of Firefox for 10-15 seconds
  3. Window finishes rendering, page content loads, user can interact.

Expected results:

Browser should not freeze at startup or when creating a new window. User should be able to immediately interact with the browser.

The Bugbug bot thinks this bug should belong to the 'Firefox::Bookmarks & History' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Bookmarks & History

On Firefox 119, the browser hangs at start-up for 10-15 seconds when there are many bookmarks in "Other Bookmarks". As well, the browser hangs when creating a new window. This seems to be a regression in 119 - I didn't experience it before in 118, and it does not happen when I downgrade to 118.

A potential workaround for users is to hide "Other Bookmarks" from the toolbar, as the browser only seems to hang at start-up/on new window when:

  1. There are many bookmarks in "Other Bookmarks"
  2. The Bookmarks toolbar is shown
  3. "Other Bookmarks" item is shown on the Bookmarks toolbar

More info on my setup:

  • This is on Linux (Kubuntu)
  • With approximately 3000 bookmarks in "Other Bookmarks"
Keywords: perf

Could you please take a performance profile using the Firefox Profiler as outlined at https://profiler.firefox.com?
There's specific instructions to get a startup profile.
IF you'r ehaving difficulties we'll try on our own (though the results may differ due to a different env, thus I'd prefer to get your perf profile).

Flags: needinfo?(wgollino)
Performance Impact: --- → ?

Sure - captured a startup profile here: https://share.firefox.dev/40NLMX8

Flags: needinfo?(wgollino)

I see a 217ms jank when we populate the bookmarks toolbar.
That is followed by a 10,2s jank where we're again reading the contents of the Other bookmarks folder here https://searchfox.org/mozilla-central/rev/d7f837add602d270f2b2958b3ab5206dc85965c0/browser/base/content/browser-places.js#2203

Both of those seem to spend most of the time in sqlite3VdbeExec, so we're effectively reading from the database. It shouldn't be that slow though, 3000 bookmarks is not much, so it's like the disk is extremely slow in reading data.

  • which kind of disk do you have, is it an SSD?
  • Which filesystem is in use on the Firefox profile partition?
Flags: needinfo?(wgollino)

Do you use bookmark tags? If yes, how many tags do you have, approximately?

I can reproduce after adding about 11K bookmarks to other bookmarks, investigating.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [sng][places-performance]

This is a regression of bug 1846361, in particular the query is spending a huge amount of time to fetch tags per each url.

Keywords: regression
Regressed by: 1846361

Set release status flags based on info from the regressing bug 1846361

Removing the needinfo as I don't need further information to fix the issue.
Thank you for reporting it with the profile, it was very useful.

Flags: needinfo?(wgollino)

:daisuke, since you are the author of the regressor, bug 1846361, could you take a look?

For more information, please visit BugBot documentation.

Flags: needinfo?(daisuke)
Assignee: nobody → mak
Status: NEW → ASSIGNED
Flags: needinfo?(daisuke)

The problem is due to reading tags per each bookmark, as unfortunately the
current tags layout is sub-optimal. For now we can either optimize for many
bookmarks or for many tags, as we know only few users use tags, and very few
have many of them (due to legacy add-ons), the only viable approach for now is
to pre-cache tags in the queries that are fetching many bookmarks.
In the future we should redesign the tags storage.

Flags: qe-verify+
Pushed by mak77@bonardo.net: https://hg.mozilla.org/integration/autoland/rev/53c65c0ddd63 Hang on window open with many bookmarks in the toolbar or Other Bookmarks. r=daisuke,places-reviewers
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch

The patch landed in nightly and beta is affected.
:mak, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox121 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(mak)

The problem is due to reading tags per each bookmark, as unfortunately the
current tags layout is sub-optimal. For now we can either optimize for many
bookmarks or for many tags, as we know only few users use tags, and very few
have many of them (due to legacy add-ons), the only viable approach for now is
to pre-cache tags in the queries that are fetching many bookmarks.
In the future we should redesign the tags storage.

Original Revision: https://phabricator.services.mozilla.com/D194506

Attachment #9365582 - Flags: approval-mozilla-beta?

Uplift Approval Request

  • Is Android affected?: no
  • Explanation of risk level: This is touching some bookmarks queries, so in case of unknown bugs it may partially break some bookmarks functionality.
  • String changes made/needed: none
  • Needs manual QE test: yes
  • User impact if declined: Hang when opening a browser window showing the bookmarks toolbar, including the first one. Hangs when opening certain bookmark folders if they contain thousands bookmarks.
  • Steps to reproduce for manual QE testing: Add 3000-10000 bookmarks to Other Bookmarks, make sure the bookmarks toolbar is visible with Other Bookmarks on it, open a new window. Firefox will hang for a few seconds (depending on the machine) without the patch.
  • Code covered by automated testing: yes
  • Risk associated with taking this patch: medium
  • Fix verified in Nightly: no

Comment on attachment 9365582 [details]
Bug 1861811 - Hang on window open with many bookmarks in the toolbar or Other Bookmarks. r=daisuke

Approved for 121.0b5.

Attachment #9365582 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [qa-triaged]

I've reproduced this issue with Fx 121.01 (2023-10-28) on Windows 10 and Fx 121.0b4 on Ubuntu 22 (with around 11K bookmarks).
The hang is no longer reproducible on Fx 122.0a1 (2023-11-28) and Fx 121.0b5 (treeherder build) on Windows 10, macOS 13 and Ubuntu 22.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
Regressions: 1867474
Flags: needinfo?(mak)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: