ShoppingUtils.init invokes NimbusFeatures.onUpdate in a loop
Categories
(Firefox :: Shopping, defect, P1)
Tracking
()
People
(Reporter: jhirsch, Assigned: jhirsch)
References
(Blocks 1 open bug)
Details
(Whiteboard: [fidefe-shopping])
Attachments
(1 file)
48 bytes,
text/x-phabricator-request
|
diannaS
:
approval-mozilla-beta+
|
Details | Review |
The ShoppingUtils.init code assumes that NimbusFeatures.shopping2023.onUpdate(callback)
does not immediately invoke the callback when it is called, but it does. This leads to a "too much recursion" error on startup if enrolled in the beta test experiment, following these steps:
- In about:config set
nimbus.debug
totrue
- open about:studies?optin_slug=review-checker-first-beta-119&optin_branch=treatment-a&optin_collection=nimbus-preview
- restart the browser
- look in the browser toolbox, observe a "Too much recursion" error calling the following functions in a loop:
InternalError: too much recursion
_onFeatureUpdate resource://nimbus/lib/ExperimentStore.sys.mjs:389
onUpdate resource://nimbus/ExperimentAPI.sys.mjs:472
init resource:///modules/ShoppingUtils.sys.mjs:61
onNimbusUpdate resource:///modules/ShoppingUtils.sys.mjs:43
_onFeatureUpdate resource://nimbus/lib/ExperimentStore.sys.mjs:389
onUpdate resource://nimbus/ExperimentAPI.sys.mjs:472
init resource:///modules/ShoppingUtils.sys.mjs:61
onNimbusUpdate resource:///modules/ShoppingUtils.sys.mjs:43
...
The problem here is that ShoppingUtils.init
, inside the if (!this.registered)
block, doesn't immediately set this.registered = true
, but instead does:
if (!this.registered) {
lazy.NimbusFeatures.shopping2023.onUpdate(this.onNimbusUpdate);
this._updateNimbusVariables();
this.registered = true;
}
It turns out that the onUpdate
call immediately invokes this.onNimbusUpdate
, which in turn calls ShoppingUtils.init
, causing an infinite loop.
We can fix this by moving the this.registered = true
line to the top of the block.
Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Assignee | ||
Comment 1•1 year ago
|
||
Comment 3•1 year ago
|
||
bugherder |
Assignee | ||
Comment 4•1 year ago
|
||
Comment on attachment 9355410 [details]
Bug 1855545: Avoid an infinite loop in ShoppingUtils.init r?mardak
Beta/Release Uplift Approval Request
-
User impact if declined: The shopping experiment will not initialize correctly, which will break some experiment telemetry.
-
Is this code covered by automated tests?: Yes
-
Has the fix been verified in Nightly?: No
-
Needs manual test from QE?: Yes
-
If yes, steps to reproduce: Opt in to the Nimbus experiment, then check for console errors and verify the telemetry is working.
-
in about:config, set
nimbus.debug
totrue
-
load about:studies?optin_slug=review-checker-first-beta-119&optin_branch=treatment-a&optin_collection=nimbus-preview
-
restart the browser
-
visit a supported product page
-
check the value of the probes
Glean.shoppingSettings.componentOptedOut
,Glean.shoppingSettings.hasOnboarded
,Glean.shoppingSettings.nimbusDisabledShopping
have been set -
List of other uplifts needed: None
-
Risk to taking this patch: Low
-
Why is the change risky/not risky? (and alternatives if risky): The shopping experiment will be limited to a very small audience.
This change is extremely small and confined to the shopping experiment initialization code.
- String changes made/needed: No
- Is Android affected?: No
Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Comment 5•1 year ago
|
||
This issue is Verified as fixed in our latest Nightly build. We are being enroled and we no longer see the recursion error.
The telemetry pings we see in glean are :
"shopping.settings.component_opted_out": false,
"shopping.settings.nimbus_disabled_shopping": false,
"shopping.settings.has_onboarded": true,
Updated•1 year ago
|
Comment 6•1 year ago
|
||
Comment on attachment 9355410 [details]
Bug 1855545: Avoid an infinite loop in ShoppingUtils.init r?mardak
Approved for 119.0b4
Updated•1 year ago
|
Comment 8•1 year ago
|
||
Verified as fixed in 119.0b4.
Description
•