Multi-account-containers: High energy inpact spikes in about:performance

Created on 21 Mar 2020  ·  12Comments  ·  Source: mozilla/multi-account-containers



  • Multi-Account Containers Version: 6.2.3

  • Operating System + Version: Linux

  • Firefox Version: 75.0b6 Developer Edition

  • Other installed Add-ons + Version + Enabled/Disabled-Status:


Amazon.com  1.1 true    [email protected]
Augmented Steam 1.4.2   true    {1be309c5-3e4f-4b99-927d-bb500eb4fa88}
Bing    1.1 true    [email protected]
Bitwarden - Free Password Manager   1.43.3  true    {446900e4-71c2-419f-a6a7-df9c091e268b}
Buster: Captcha Solver for Humans   0.7.1   true    {e58d3966-3d76-4cd9-8552-1582fbc800c1}
Decentraleyes   2.0.13  true    jid1-BoFifL9Vbdl2zQ@jetpack
DuckDuckGo  1.0 true    [email protected]
eBay    1.0 true    [email protected]
Enhancer for YouTube™   2.0.99  true    [email protected]
Firefox Multi-Account Containers    6.2.3   true    @testpilot-containers
Google  1.0 true    [email protected]
google-no-tracking-url  3.0.0   true    jid1-zUrvDCat3xoDSQ@jetpack
HTTPS Everywhere    2019.11.7   true    [email protected]
Reddit Enhancement Suite    5.18.11 true    jid1-xUfzOsOFlzSOXg@jetpack
RESTer  4.0.0   true    [email protected]
SimpleLogin | Your anti-spam superhero 🦸‍♂️ 1.2.0   true    addon@simplelogin
SponsorBlock for YouTube - Skip Sponsorships    1.2.22  true    [email protected]
Stylus  1.5.10  true    {7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}
Terms of Service; Didn’t Read   2.0.0   true    jid0-3GUEt1r69sQNSrca5p8kx9Ezc3U@jetpack
The Stream Detector 1.9.0   true    @m3u8link
Torrent Control 0.2.15  true    {e6e36c9a-8323-446c-b720-a176017e38ff}
Twitter 1.0 true    [email protected]
uBlock Origin   1.25.2  true    [email protected]
uGet Integration    2.1.3.1 true    uget-integration@slgobinath
Violentmonkey   2.12.7  true    {aecec67f-0d10-4fa7-b7c7-609a2db280cf}
Vue.js devtools 5.3.3   true    {5caff8cc-3d2e-4110-a88a-003cc85b3858}
Wikipedia (en)  1.0 true    [email protected]
Windscribe - Free Proxy and Ad Blocker  3.1.4   true    @windscribeff

Actual behavior

image

When monitoring about:performance, for some reason the add-on seems to spike to 110-150+ on energy impact and going back down every 2-3 seconds. It persists a browser restart. I've also tried it on Nightly.

I also have an issue where pages seem to have a long 2-3 seconds delay before starting to load, but I'm not sure if it's caused by this.

Expected behavior

Stable energy impact with decent page load speeds.

Steps to reproduce

  1. Launch browser
  2. Visit about:performance and monitor the usage

Notes

Very likely similar to this issue https://github.com/mozilla/multi-account-containers/issues/572

All 12 comments

I can confirm I'm seeing similar spikes, and it's causing up to 5 _minutes_ of page load delay for me at times. Restarting firefox can fix it for a while but things slow down again. I'm not sure if the slowdown is time or activity based, but it seems bad if I've left Firefox open overnight.

When I disable this extension, page loads immediately improve.

I don't have this extension on private windows, and those load quickly and normally when normal windows are not.

I have eight containers defined, with a variety of websites opening in each. My work one in particular has ~20 sites defined.

I'm also seeing this problem on 75.0 on Mac 10.13.6. I have 20 containers, some with 1 or 2 sites defined, some with around 8 sites defined.

Next time someone encounters this, try going to https://profiler.firefox.com/ and capturing a profile. I tried on the "Firefox Front-end" capture profile and saw a large amount of CPU time, 75% or so, spent in a JS Async/Await function and a lot of calls related to "Sync", so it must be a regression caused by the new syncing feature in 6.2. Some kind of tight loop attempting to sync too frequently.

Unfortunately I had to drop what I was doing and didn't upload the profile, and haven't reproduced the problem again, so maybe someone else can contribute a profile if they encounter the problem.

Here is a "Firefox Front-end" profile when I was experiencing the performance hit:

https://perfht.ml/3bDNzn8

I started the profile, opened a new default/unassigned container tab, and navigated to Amazon which is set to automatically re-open in a shopping container. Once Amazon loaded I stopped the capture.

I set the capture to include extension information, but if I need to include other options please let me know.

I did one too, with an amazon tab set to open in shopping the same as
Derek. Not sure I did it correctly, I've never used profiler before.

https://perfht.ml/2W73LXq

@bluevulpine @narq Thanks for these! The profiles look similar to what I saw on my machine.

To get a clearer picture when viewing the profile results, use the blue "tracks visible" dropdown at the top to show only WebExtensions process, and hit the radio button for "JavaScript" stack (next to All stacks and Native). Excessive CPU time spent in the promise/async/await tight loop, and looks like it's hitting IndexedDB a lot.

I've just done 2 traces with the settings you requested - another amazon
loading from an empty tab into a shopping tab. And another example from an
existing shopping tab, on aliexpress.com, just clicking on a link. When
multi-account-containers is running, after a while, everything slows down
very dramatically.

https://perfht.ml/2VHmNof - amazon from a an empty tab set to open in
shopping container
https://perfht.ml/2YcSWGc - clicking a link on aliexpress in pre-existing
shopping container

Anyone have experience debugging WebExtensions? The code is commented decently and even has a mention of infinite loops; in fact this area of code might be the culprit, since the surrounding functions do show up in the profile captures:

https://github.com/mozilla/multi-account-containers/blob/532abbf0324241291fcc533b583aa0d15d32c9dd/src/js/background/sync.js#L111-L128

If we suspect this code, then it could be checkForListenersMaybeAdd() is getting called elsewhere, interleaved with the async execution of this block, and causing the infinite loop. There are only 2 other places it's called; either sync.init(), or there is a caught exception:

https://github.com/mozilla/multi-account-containers/blob/532abbf0324241291fcc533b583aa0d15d32c9dd/src/js/background/sync.js#L201-L213

https://github.com/mozilla/multi-account-containers/blob/532abbf0324241291fcc533b583aa0d15d32c9dd/src/js/background/sync.js#L215-L220

I lack experience debugging WebExtensions though, not sure easiest way to set up an environment that we could trigger a sync and get some debug logs.

I think I have the solution. Could anyone verify if it fixes your problem? https://github.com/mozilla/multi-account-containers/pull/1757

Possibly. It's better than it was, and I thought it was fixed for a few days, but #1768 might be part of the same issue, and I'm unable to run it at the moment without my machines getting hammered.

1768 might be part of the same issue

Yeah, I think so too.

Screenshot from 2020-05-30 17-11-05

Hopefully it get fixed soon.

Has anyone had any luck with a solution for this problem? I have noticed that with the recent updates to Firefox & Nightly this has been getting much worse. I have Windows and Linux systems (multiple distros), so please let me know if there is anything I can do to help resolve this issue.

Was this page helpful?
0 / 5 - 0 ratings