Closed Bug 719601 Opened 12 years ago Closed 12 years ago

High memory usage and long GC/CC times with 1Password add-on enabled

Categories

(WebExtensions :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: davehunt, Unassigned)

References

Details

(Whiteboard: [MemShrink:P3])

I'm seeing long GC/CC times and high memory usage with the 1Password extension enabled. The following was gathered using the MemChaser addon:

Resident: 1375MB, GC: 1633.0ms (8.272s), CC: 2537ms (8.376s)

In about:memory the largest single compartment is owned by 1Password:

189.40 MB (14.62%) -- compartment([System Principal], resource://onepasswo...

If I disable 1Password and restart Firefox then the memory usage and GC/CC never reach such levels.

1Password version is 3.9.0b6

You can currently download MemChaser from the following location:
https://github.com/whimboo/memchaser/downloads
I just found a topic in the AgileBits support discussions, which suggests a new beta version will be available soon to address this.

See: http://support.agilebits.com/discussions/browser-extensions/1257-firefox-performance-degrades-with-extension
Which version(s) of Firefox is this reproducible?
The current version could be a good test case for incremental GC and improved CC, even if they fix the problem.
Whiteboard: [MemShrink]
Summary: High GC times with 1Password add-on enabled → High GC/CC times with 1Password add-on enabled
I've so far replicated it specifically with Firefox 10 and 11. I can run with Firefox 9 for a while to see if it also occurs, however I suspect the majority of the users reporting the issue on the AgileBits discussion board are using released versions of Firefox.
Blocks: LeakyAddons
Summary: High GC/CC times with 1Password add-on enabled → High memory usage and long GC/CC times with 1Password add-on enabled
Whiteboard: [MemShrink] → [MemShrink:P3]
Thanks for opening this bug Dave.

I just wanted to add a few things that might help:

First, beta 7 is out now and so beta 6 is no longer linked to anymore. You can download beta 6 directly from here: 

http://cdn.agilebits.com/dist/1P/ext/1Password-3.9.0.b6.xpi

Second, I managed to stop the bleeding in beta 7 by reworking our code. It's not ideal but I basically removed some functionality. The issue was I needed to iterate over all the elements in the DOM (in our end script). Simply by iterating over the elements Firefox's memory usage would increase dramatically. A great test page a user gave was this one:

http://www.greenmountaincoffee.com/shop/k-cups-category?facets=All%20K-Cup%20Varieties%3ACoffee&TitleTag=K-Cup%20Varieties#back

While on this page if I looped through document.getElementsByTagName("*") memory usage would literally increase by over 200MB. Hopefully there is a better way to do this. 

I'll try to isolate the problem further and get it into a shareable state. I wonder, is there a typical Add-on SDK based extension template you guys use for testing? I could add my code there. The only big requirements is it must have an end script and be using the SDK.

--
Dave Teare
1Password Co-author
Dave, have you made any progress with this you can share with us?
@Dave Teare, we would like to know what your current plans are for releasing version 3.9.0.

@Dave Hunt: can you please test with this version and see if it makes a difference?
http://cdn.agilebits.com/dist/1P/ext/1Password-3.9.0.b7.xpi
I have tested with 1Password 3.9.0.b7 and Firefox 11, and replicated memory/performance issues.

Steps to reproduce:

1. Start Firefox with a fresh profile
2. Install 1Password from http://cdn.agilebits.com/dist/1P/ext/1Password-3.9.0.b7.xpi
3. Open www.amazon.co.uk
4. Use 1Password to sign in to Amazon
5. Open about:memory in another tab
6. Force refresh of about:memory, and the memory usage steadily increases. Ultimately GC/CCs increase in duration.

Note that this isn't realistic usage, but allowed me to replicate the increasing memory usage in a short time. I suspect leaving Firefox open with typical daily usage would replicate this over time. I will also attempt using this version of 1Password on my daily profile and report if I notice any noticeable performance issues.

I used MemChaser (https://addons.mozilla.org/en-US/firefox/addon/memchaser/) to monitor resident memory and GC/CC times, however I was able to replicate the issue with MemChaser disabled.

Unfortunately, it appears the AgileBits discussion is now marked private. If you create a profile you will be able to view it.

One of the recent suggestions was to disable the 'Auto Submit' feature. I've tried this and it makes no noticeable difference to the outcome of the above steps.
Component: General → Add-ons
Product: Firefox → Tech Evangelism
Email sent to the folks at Agile Bits asking if there's an update or assistance that can be rendered.
I had a brief email discussion with Dave Teare and he mentioned a 3.9.2 version that addresses most if not all memory concerns. I asked him to post a link to a test build here, but he hasn't yet. I'll poke him again to see if we can move things along.
Thanks for the nudge Jorge, this todo got lost in the shuffle. I get WAY too much email :)

Yes, this has been fixed in the latest version of the 1Password extension. While the vast majority of performance improvements were made in 3.9.0 beta 7 (as I mentioned above, it was from iterating over all the DOM elements) we had a regression in 3.9.1 related to DOM mutation events and this was fixed in 3.9.2. 

We're up to version 3.9.4 already so that's the one you'll likely want to verify. You can grab the latest version from here:

https://agilebits.com/extensions/mac/index.html

As far as I can tell all memory leaks except for one related to the AddOn SDK w/r/t context menus has been fixed. The context menu leak will be fixed when we upgrade to version 1.6.1 of the SDK. If you find any other leaks or performance problems, please show me how to recreate them and I'll be happy to look into it.

Cheers!

--
Dave Teare
AgileBits Founder
So, the main memory usage problems have been resolved, but there are still leaks associated to using an old version of the SDK. Once the add-on has been upgraded to 1.6.1 or higher, we can retest and verify everything is fixed.
Severity: major → normal
I can confirm that the memory usage is much better in 3.9.4b1.
Dave Teare: do you know when you'll have a version available that uses SDK 1.6.1 (or higher) ?
Hi Andrew,

I was hoping to get it done before WWDC but I'm running out of time. I'll try to release a beta with the new SDK once the dust settles and we're all back.
Dave, do you have any updates for us?
Woops! I didn't reply right away and forgot. I'm sorry about that Jorge.

We just released a new beta that includes a newer version of the Addon SDK. It's available from this page (be sure to click the Allow betas checkbox):

https://agilebits.com/extensions/mac/index.html

The new beta uses version 1.8 of the Addon SDK. Please try the beta and see if the newer SDK helps.
Dave Hunt, can you try the new version and report back whether it fixes your problems?  Thanks.
As mentioned in comment 13, the noticeable memory leak was already resolved in 3.9.4b1. I'm away until Monday, but can focus some time testing the latest version then. I have been using the latest version in my daily profile and haven't noticed any issues there.
I'm happy to marked this as resolved. I've just tried replicating with my steps from comment 8 and was unable to see any obvious memory leaks.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Tested against:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:14.0) Gecko/20100101 Firefox/14.0.1
1Password 3.9.6.b2 onepassword@agilebits.com
Component: Add-ons → General
Product: Tech Evangelism → WebExtensions
You need to log in before you can comment on or make changes to this bug.