CPU usage in StructuredCloneHolder.deserialize starting version 115 far higher than in 114 with Dashlane extension
Categories
(WebExtensions :: Storage, defect)
Tracking
(Performance Impact:low, firefox-esr102 unaffected, firefox-esr115 wontfix, firefox114 unaffected, firefox115 wontfix, firefox116 wontfix, firefox117 wontfix, firefox118 wontfix)
Performance Impact | low |
Tracking | Status | |
---|---|---|
firefox-esr102 | --- | unaffected |
firefox-esr115 | --- | wontfix |
firefox114 | --- | unaffected |
firefox115 | --- | wontfix |
firefox116 | --- | wontfix |
firefox117 | --- | wontfix |
firefox118 | --- | wontfix |
People
(Reporter: quadristan, Unassigned, NeedInfo)
References
(Regression)
Details
(Keywords: perf:resource-use, perf:responsiveness, regression)
Steps to reproduce:
- Interact on a webpage with an extension that communicates to a background page
Hello,
I work at Dashlane and we noticed a latency in our product since 115.
On 115 we notice a latency: https://share.firefox.dev/442n3Pj
On 114 all seems good https://share.firefox.dev/3N5xAlN
Initially posted in https://bugzilla.mozilla.org/show_bug.cgi?id=1833016#c17
Actual results:
On version 115, we notice an increase of CPU in StructuredCloneHolder.deserialize. This can slow down our web extension.
We suspect it happens during runtime.postMessage / or port.postMessage
Performance profiling here https://share.firefox.dev/442n3Pj
I do not have a simple open-source reproduction repository yet.
Expected results:
On version 114 all seems good https://share.firefox.dev/3N5xAlN
Comment 1•1 years ago
|
||
Kris, the reporter suspects bug 1769763 could have caused this. It does seem plausible given the time in the profile is being spent in StructuredCloneHolder deserialize. Could you take a look? Thanks.
Comment 2•1 years ago
|
||
The bug has a release status flag that shows some version of Firefox is affected, thus it will be considered confirmed.
Comment 3•1 years ago
|
||
(In reply to Andrew McCreight [:mccr8] from comment #1)
Kris, the reporter suspects bug 1769763 could have caused this. It does seem plausible given the time in the profile is being spent in StructuredCloneHolder deserialize. Could you take a look? Thanks.
I don't think that's possible. That change shouldn't affect StructuredCloneHolder.deserialize
at all. It should really only affect creation and sending between processes. And the bulk of the overhead in js::AtomizeString
, which wouldn't apply to the debug names at all.
Updated•1 years ago
|
Comment 5•1 years ago
|
||
It can be a little tedious, but if you can't come up with a test case we can try, you could use MozRegression to figure out what caused the regression. Finding a regressor is usually a good step towards getting some forward movement on a mysterious issue. Thanks.
Updated•1 years ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 6•1 year ago
|
||
Tristan, did you have the opportunity to try and find the regression range with mozregression? Thanks
No I did not have the time yet. The workflow takes 3 minutes to execute, I attempted to create an easiest repro without success so far ( it looks like doing postMessage "ping" between the background page and the content script isn't enough to see the issue)
STR:
- Visit https://webmail.gandi.net/roundcube/ with Dashlane installed.
- Enable performance capture.
- Click Dashlane icon in login field.
- Click "Add a new login" and let tab open.
- Stop performance capture.
Dashlane tab opens and does work with significant StructuredCloneHolder.deserialize
in webextension process that did not appear previously.
Regression window:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=21476ba58834885fe3b0ca8b9a916f0ed57616de&tochange=532904ff2fffa0332a2d6136792b03a9ae6bcac1
Regressed by Bug 1823713.
Comment 10•1 year ago
|
||
Thanks Kestrel for the regression range!
Tomislav, it seems that bug 1823713 caused this regression, would backing it out in a 115 dot release be a feasible option or do we need a follow up fix on the release branch? Thanks
Comment 11•1 year ago
|
||
The product::component has been changed since the backlog priority was decided, so we're resetting it.
For more information, please visit BugBot documentation.
Comment 12•1 year ago
|
||
Set release status flags based on info from the regressing bug 1823713
Reporter | ||
Comment 13•1 year ago
|
||
Thank you Kestrel for the mozregression usage. I tried to do it at work, but our proxy/cloudflare setting is making this complicated.
So I think you helped me a lot to understand what is going on.
TL-DR: Dashlane is using storage.session when available, to avoid losing data due to service worker termination. Even in MV2.
We already have a fix: we wont use storage.session in Mv2.
Now, I am curious why persisting data in the session storage seems significant, CPU-wise, and what can we do to help.
Writing base-64 in it, maybe?
Comment 14•1 year ago
|
||
Tristan - are you using storage.onChanged
? If so, you may be affected by bug 1842009.
To avoid the issue, register onChanged
on the specific storage areas of interest, e.g.
NOT:
storage.onChanged
Use one or all of these as appropriate:
storage.local.onChanged
storage.sync.onChanged
storage.session.onChanged
(only if interested in the data; doesn't work in content scripts).
Reporter | ||
Comment 15•1 year ago
|
||
Ha! We finally pushed a new version of our extension, making it stop using the session storage in mv2. So I cannot reproduce the issue in mv2 anymore.
We only do storage.area.onChanged
. We shouldnt be affected by #1842009.
I see however that we do multiple calls to it in mv3, I am going to investigate the impact of that and make sure we have only a single listener if this matters.
Updated•1 year ago
|
Updated•1 year ago
|
Comment 16•1 year ago
|
||
The Performance Impact Calculator has determined this bug's performance impact to be low. If you'd like to request re-triage, you can reset the Performance Impact flag to "?" or needinfo the triage sheriff.
Platforms: macOS
Impact on browser: Causes noticeable jank
Configuration: Specific but common
Resource impact: Some
Description
•