mozilla / multi-account-containers

Firefox Multi-Account Containers lets you keep parts of your online life separated into color-coded tabs that preserve your privacy. Cookies are separated by container, allowing you to use the web with multiple identities or accounts simultaneously.
https://addons.mozilla.org/firefox/addon/multi-account-containers/
Mozilla Public License 2.0
2.75k stars 344 forks source link

high CPU usage when sorting many tabs #2289

Open rolandog opened 2 years ago

rolandog commented 2 years ago
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
Google 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 false
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

Actual behavior

So, I had a couple of very busy months that lead me to having around (don't judge me... too harshly) 2000 tabs open. I had been kicking the can down the road of properly sorting and organizing tabs, so I decided to "Sort Tabs by Container"... and this ended up nearly crashing my laptop, and hogging a lot of CPU and memory, and even using swap.

I decided to de-duplicate some tabs with Foxytab, and then tried sorting by URL (I know this is out of scope), but that did end up leaving the laptop in an unresponsive state, and I had to physically reboot.

After sending to OneTab, the total tab count was 2003: (1994 tabs, plus 9 pinned tabs).

I think I will report the bug in three places: here (the multi-account-containers add-on repository), in the FoxyTab repository, and in Firefox's Bugzilla, since I think that using so much memory for sorting tabs shouldn't be necessary.

Expected behavior

Sorting a lot of tabs should not require so much CPU and Memory (perhaps the tabs were being brought out of sleep just to be able to be re-ordered?)

Steps to reproduce

  1. Have browser.tabs.unloadOnLowMemory set to true
  2. Browse until you have about 2000 tabs in several different containers (+ some pinned tabs)
  3. Sort by containers

Notes

This may be related to #1869, and to #572.

Here a screenshot of htop showing the memory usage of Firefox while sorting by container:

htop-firefox-multi-account-containers-cropped

And here's a screenshot of htop of the laptop's baseline after closing Firefox (I can't remember if I interrupted the sorting or left it to finish):

htop-firefox-closed

rolandog commented 2 years ago

I reported the behavior upstream (Possible sleeping tab wake-up leading to high CPU and memory usage when sorting many (many) tabs). I'm still not sure what is the cause.

dannycolin commented 1 year ago

I'm not an expert in reading this kind of report but having a performance profile recording of this issue could probably give us more information of what's going on. You can record a profile with https://profiler.firefox.com/ and share it here.

If you need help, you can join #profiler:mozilla.org and/or #perf:mozilla on our Mozilla Matrix Server. See https://wiki.mozilla.org/Matrix to a quick how-to connect to Matrix.