Possible sleeping tab wake-up leading to high CPU and memory usage when sorting many (many) tabs
Categories
(Firefox :: Tabbed Browser, defect)
Tracking
()
People
(Reporter: rolandog, Unassigned, NeedInfo)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:98.0) Gecko/20100101 Firefox/98.0
Steps to reproduce:
I discovered this bug while sorting tabs with two different add-ons (one of which is Mozilla's "Firefox Multi-Account Containers"), and I have already filed a bug in their repositories:
https://github.com/mozilla/multi-account-containers/issues/2289
But, I have reason to think that this is an "upstream" bug.
As I mentioned in the extension's repository's issue tracker, I had accumulated a bit more than 2000 open tabs (I thought it must've been around 200, but---after deduplication---OneTab reported 1994 tabs ... plus the 9 pinned ones I had). I decided to tackle my tab problem by sorting the tabs first.
Actual results:
When sorting by container with Multi-Account Container, I noticed that there was a lot of intensive resource usage. I even decided to take a couple of screenshots.
I think I may have interrupted the process by closing Firefox... but I think it had actually completed sorting by container.
However, when sorting with FoxyTab by ascending URL, I reached maximum memory and swap usage and had to do a hard reset.
I think tabs were being woken up (I do have browser.tabs.unloadOnLowMemory
set to true
) in order to be re-ordered.
Expected results:
Tabs shouldn't have needed to be woken up, and re-ordering tabs shouldn't have required a lot of memory and CPU.
Comment 1•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::Tabbed Browser' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Reporter | ||
Comment 2•3 years ago
|
||
Possibly related to #1751720
Comment 3•3 years ago
|
||
The severity field is not set for this bug.
:dao, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 4•3 years ago
|
||
This report appears to be a one-time-reproduction situation with relatively vague steps to reproduce that would result in unreliable test results.
In any case, I've attempted reproduction on Windows 10 and Ubuntu 21 + Release v98.0.2:
- I have loaded a session of ~500 open random tabs
- Installed Facebook Multi-Account Containers addon
- Synced into Firefox (appears to be required to use the "syncing containers" feature of the addon)
- Click the addon's icon in the top bar, then click the "Sort tabs by container" option.
Expected: The browser's performance should not be affected considerably by this action.
Actual: The CPU spikes from about 10-20% overall utilization to about 60-70% and a mild slowness of browser response is observed for about 5-10 seconds.
Note: I was using an AMD 6core 3.9Ghz processor and 12GB RAM on Windows 10 and 8core and 16GB RAM on Ubuntu 21.
- Installed Foxytab addon.
- Make sure browser.tabs.unloadOnLowMemory is true. It is true by default.
- Click the addon's icon in the top bar, then click the "Recount" option.
Observe: Nothing happens. Tabs dont appear to reload, as stated by the reporter.
rolandog, can you help us with your report? Please answer some questions:
- What kind of ordering are you using (for each of these addons)?
- Can you provide exact steps to reproduce that would show your reported issue?
- Do all of your 2k tabs have an association to a container?
Reporter | ||
Comment 5•3 years ago
|
||
Hi Daniel.
- Regarding the ordering, I tried 'Sort tabs by container' in Firefox Multi-Account Containers (FMAC), and 'Sort by URLs Ascending' with FoxyTab (when you right click on a tab, the menu is in
FoxyTab > Sort > By Urls Ascending
). - I'll add some information about my environment (I had reported this elsewhere, but I didn't include this info here because I wasn't prompted for it); also, I will try to reproduce the issue and document the step-by-step procedure by loading the tabs when I get home later in the evening.
- Not all of the tabs were associated to a container. Some were automatically opened in their respective container tabs, others were automatically opened in their special container (Facebook Container, Google Container), but I think more than half were not opened in a container. I only had less than 10 tabs pinned as well.
I did have several add-ons installed (quoting the table I listed in the bug-report for Firefox Multi-Account Containers (FMAC)):
Name | Type | Version | Enabled |
---|---|---|---|
British English Dictionary (Marco Pinto) | dictionary | 3.0.5 | true |
English United States Dictionary | dictionary | 91.0 | true |
Spanish (Mexico) Dictionary | dictionary | 2.6 | true |
Spell checker for es-ES | dictionary | 2.6 | true |
Woordenboek Nederlands | dictionary | 4.20.19 | true |
Add-ons Search Detection | extension | 2.0.0 | true |
Amazon.co.uk | extension | 1.9 | true |
Bing | extension | 1.3 | true |
Cookie AutoDelete | extension | 3.6.0 | true |
Copy as Org-Mode | extension | 0.1.1 | true |
Decentraleyes | extension | 2.0.17 | true |
Disconnect | extension | 20.3.1.1 | true |
DuckDuckGo | extension | 1.1 | true |
eBay | extension | 1.3 | true |
EPUBReader | extension | 2.0.13 | true |
Facebook Container | extension | 2.3.1 | true |
Feedbro | extension | 4.11.9 | true |
Firefox Multi-Account Containers | extension | 8.0.5 | true |
Flagfox | extension | 6.1.47 | true |
FoxyTab | extension | 2.15 | true |
GNOME Shell integration | extension | 10.1 | true |
extension | 1.1 | true | |
Google Container | extension | 1.5.4 | true |
HTTPS Everywhere | extension | 2021.7.13 | true |
JabRef Browser Extension | extension | 2.5 | true |
Link Gopher | extension | 2.4.4 | true |
Livemarks | extension | 3.4 | true |
NoScript | extension | 11.2.25 | true |
Notes by Firefox | extension | 4.3.7 | true |
OneTab | extension | 1.54 | true |
Org Capture | extension | 0.2.1 | true |
Print Edit WE | extension | 29.0 | true |
Privacy Badger | extension | 2021.11.23.1 | true |
SQRL | extension | 0.0.56 | true |
Trace - Online Tracking Protection | extension | 3.0.7 | true |
uBlock Origin | extension | 1.41.2 | true |
Wayback Machine | extension | 1.8.6 | true |
Wikipedia (en) | extension | 1.1 | true |
English (CA) Language Pack | locale | 98.0buildid20220213.185901 | true |
English (GB) Language Pack | locale | 98.0buildid20220213.185901 | true |
English (US) Language Pack | locale | 98.0buildid20220213.185901 | true |
Español (AR) Language Pack | locale | 98.0buildid20220213.185901 | true |
Español (Chile) Language Pack | locale | 98.0buildid20220213.185901 | true |
Español (España) Language Pack | locale | 98.0buildid20220213.185901 | true |
Español (México) Language Pack | locale | 98.0buildid20220213.185901 | true |
Nederlands (NL) Language Pack | locale | 98.0buildid20220213.185901 | true |
BibItNow! | extension | 0.902 | false |
Bitly | Powerful Short Links | extension | 3.0.7 |
Cookie Quick Manager | extension | 0.5rc2 | false |
Copy Selection as Markdown | extension | 0.21.0 | false |
Improved History | extension | 0.1.1 | false |
Send to Outline | extension | 1.4.1 | false |
Stylus | extension | 1.5.21 | false |
User-Agent Switcher | extension | 1.4.1 | false |
I have since then also installed Tree Style Tab (to structure the tabs by project).
I will soon try to reproduce the bug, but first I'm trying to see what could've caused the huge memory usage, so I can try to replicate the issue.
I did a small dive and tried reading the ES6 source-code for the sorting algorithm used in FMAC.
I was wondering: Do you know if there are any theoretical byte-size limits on the size of the Maps and Arrays for Firefox? (as this article suggests a 268 MB memory limit for fast arrays for Chrome). I'm asking because I'm not that familiar with the internals of the extensions API, and how much information is returned by the browser.tabs.query({windowId: windowObj.id})
call.
I think I saved a lot of the tabs before sorting as a list of links with OneTab, so I'll give it a go when I return home.
Reporter | ||
Comment 6•3 years ago
|
||
Well, I can now report that trying to load ~2000 tabs had a similar effect. 😅 I think it must've been around the 1500 tab mark that I must've hit full usage of Swap and memory.
Shouldn't the option of browser.tabs.unloadOnLowMemory being set to true have helped prevent this?
Comment 7•2 years ago
|
||
I've retried this process with 1500 random opened tabs; Sorting in different ways using foxytab, does not reproduce any kind of freeze or crash. Moreover, it happens quickly and it does not spike resource usage that much.
I suspect it might be related to your addons. Many of the addons in comment 5 can't be found in addons.mozilla.org.
Can you re-try your steps in safe mode? Let us know of the results.
info: https://support.mozilla.org/en-US/kb/troubleshoot-extensions-themes-to-fix-problems
Thank you for your contribution!
Comment 8•2 years ago
|
||
Redirect a needinfo that is pending on an inactive user to the triage owner.
:dao, since the bug has recent activity, could you have a look please?
For more information, please visit auto_nag documentation.
Description
•