Closed Bug 1782854 Opened 3 years ago Closed 3 years ago

favicons.sqlite grows in size with no limit

Categories

(Toolkit :: Places, defect, P2)

Firefox 103
defect

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: miker, Assigned: mak)

References

Details

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:103.0) Gecko/20100101 Firefox/103.0

Steps to reproduce:

I use Apache Guacamole for remote work. One of its features is to set the site's favicon to a tiny representation of the remote desktop, which updates every few seconds.

Actual results:

Over time, Firefox's favicons.sqlite database grows extremely large. After a couple of months, it's over 5GB, and causing noticeable slowdowns. This has been an issue with every version of Firefox I've used over the last couple of years (not a regression in v103).

I inquired with the Guacamole project, and they suggested filing a bug report here since it's not a bug per-se in Guacamole.

Expected results:

Firefox should limit the favicons.sqlite database to a reasonable (perhaps even user-configurable) size.

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

Component: Untriaged → Layout
Product: Firefox → Core
Component: Layout → Places
Product: Core → Toolkit

We had a similar report recently where an add-on was changing the favicon continuously and we were storing it.
Now, the server could just set the no-store header and we'd not store it... but most don't do that unfortunately.
We have code in place to ignore any favicon set after the pageshow event, that should prevent this from happening, but for some reason it doesn't...

I will try reproducing this with Apache Guacamole and see why it'd bypass our checks.

Flags: needinfo?(mak)

Ok, I followed a long procedure to install guacamole and I think I found the problem, these pages, similarly to the previous add-on case, set favicon using data uris.
When that happens the code takes a different path than network loaded images, and FaviconLoader assumes it can always load the favicon:
https://searchfox.org/mozilla-central/rev/9cd1e8cabf67ef5a47e95d70b7f40c9d3ad02ad0/browser/modules/FaviconLoader.jsm#545,563

So our beforePageShow check doesn't apply to this case https://searchfox.org/mozilla-central/rev/9cd1e8cabf67ef5a47e95d70b7f40c9d3ad02ad0/browser/modules/FaviconLoader.jsm#258

I'm setting this as an S2 because as a consequence one can easily hit a case where favicons.sqlite grows to multiple GB and that will definitely cause performance problems overall. I'm also assigning to myself.
I'm not sure there's an easy way to fix existing dbs that may be affected, though the icons should be bound to the page who loaded them and expired with it. It may be worth filing a follow-up to maybe check with Places Maintenance if a page has too many icons stored and expire the ones older than N days.

Assignee: nobody → mak
Severity: -- → S2
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: needinfo?(mak)
Priority: -- → P2
Blocks: 1786253
Pushed by mak77@bonardo.net: https://hg.mozilla.org/integration/autoland/rev/64f9bfbf800e Don't store local uri favicons after pageShow. r=mossop

thanks, I used this.beforePageShow, but that's defined in another class, I should have used iconInfo.beforePageShow.
We don't have an explicit test about storing data uri icons thus I'll add one.

Flags: needinfo?(mak)
Attachment #9291081 - Attachment is obsolete: true
Pushed by mak77@bonardo.net: https://hg.mozilla.org/integration/autoland/rev/78fc9399cf70 Don't store local uri favicons after pageShow. r=mossop
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: