Skip to content

Bug 2024298 - Fix edge case when errors occur on a multi-pref experiment in Nimbus#7273

Open
ohall-m wants to merge 1 commit intomozilla:mainfrom
ohall-m:2024298
Open

Bug 2024298 - Fix edge case when errors occur on a multi-pref experiment in Nimbus#7273
ohall-m wants to merge 1 commit intomozilla:mainfrom
ohall-m:2024298

Conversation

@ohall-m
Copy link
Contributor

@ohall-m ohall-m commented Mar 18, 2026

A bad unwrap occurs when a multi-pref experiment fails.

Pull Request checklist

  • Breaking changes: This PR follows our breaking change policy
    • This PR follows the breaking change policy:
      • This PR has no breaking API changes, or
      • There are corresponding PRs for our consumer applications that resolve the breaking changes and have been approved
  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGELOG.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due diligence applied in selecting them.

@ohall-m ohall-m added nimbus Nimbus, the experimentation platform. rust Pull requests that update Rust code labels Mar 18, 2026
@ohall-m
Copy link
Contributor Author

ohall-m commented Mar 18, 2026

Some background:

Given FML like this:

  gecko-nimbus-validation-multi-pref-user:
    description: "Feature for validating Nimbus Gecko functionality with multiple preference types on user branch"
    variables:
      anchor-color-dark:
        description: "Shipped default #00CADB"
        type: String
        default: "#000000"
        gecko-pref:
          pref: "browser.anchor_color.dark"
          branch: "user"
      autofocus:
        description: "Shipped default false"
        type: Boolean
        default: false
        gecko-pref:
          pref: "browser.autofocus"
          branch: "default"

When they both fail to set, they try to unenroll. Right now, the second one hits:

03-18 11:54:36.481 17377 17377 D AndroidRuntime: Shutting down VM
03-18 11:54:36.482 17377 17377 E AndroidRuntime: FATAL EXCEPTION: main
03-18 11:54:36.482 17377 17377 E AndroidRuntime: Process: org.mozilla.fenix.debug, PID: 17377
03-18 11:54:36.482 17377 17377 E AndroidRuntime: org.mozilla.geckoview.GeckoResult$UncaughtException: org.mozilla.experiments.nimbus.internal.InternalException: called `Option::unwrap()` on a `None` value
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.geckoview.GeckoResult.dispatchLocked(GeckoResult.java:782)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.geckoview.GeckoResult.completeExceptionally(GeckoResult.java:925)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.geckoview.GeckoResult.lambda$thenInternal$6(GeckoResult.java:606)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.geckoview.GeckoResult.$r8$lambda$82f7lYxeXTzVvMgd9wZnqr4Ug34(Unknown Source:0)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.geckoview.GeckoResult$$ExternalSyntheticLambda7.run(D8$$SyntheticClass:0)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.geckoview.GeckoResult.lambda$dispatchLocked$7(GeckoResult.java:797)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.geckoview.GeckoResult$$ExternalSyntheticLambda8.run(D8$$SyntheticClass:0)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:958)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:99)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:205)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:294)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:8177)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: Caused by: org.mozilla.experiments.nimbus.internal.InternalException: called `Option::unwrap()` on a `None` value
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.experiments.nimbus.internal.NimbusKt.uniffiCheckCallStatus(nimbus.kt:384)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.experiments.nimbus.internal.NimbusKt.access$uniffiCheckCallStatus(nimbus.kt:1)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.experiments.nimbus.internal.NimbusClient.unenrollForGeckoPref(nimbus.kt:3101)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.experiments.nimbus.Nimbus.unenrollForGeckoPref(Nimbus.kt:461)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.fenix.experiments.prefhandling.NimbusGeckoPrefHandler.handleErrors(NimbusGeckoPrefHandler.kt:171)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.fenix.experiments.prefhandling.NimbusGeckoPrefHandler.applyEnrollmentPrefs$lambda$0(NimbusGeckoPrefHandler.kt:323)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.fenix.experiments.prefhandling.NimbusGeckoPrefHandler.$r8$lambda$xCnViHOCuX-0NDvgsfw2YU3Up-Q(Unknown Source:0)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.fenix.experiments.prefhandling.NimbusGeckoPrefHandler$$ExternalSyntheticLambda3.invoke(D8$$SyntheticClass:0)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at mozilla.components.browser.engine.gecko.GeckoEngine.setBrowserPrefs$lambda$1(GeckoEngine.kt:1300)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at mozilla.components.browser.engine.gecko.GeckoEngine.$r8$lambda$STYT63XFj_Wj9bImnp6WV-iEtJY(Unknown Source:0)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at mozilla.components.browser.engine.gecko.GeckoEngine$$ExternalSyntheticLambda19.onValue(D8$$SyntheticClass:0)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	at org.mozilla.geckoview.GeckoResult.lambda$thenInternal$6(GeckoResult.java:593)
03-18 11:54:36.482 17377 17377 E AndroidRuntime: 	... 12 more
03-18 11:54:36.483 17377 17377 E ExceptionHandler: Uncaught exception handled: 
03-18 11:54:36.483 17377 17377 E ExceptionHandler: org.mozilla.geckoview.GeckoResult$UncaughtException: org.mozilla.experiments.nimbus.internal.InternalException: called `Option::unwrap()` on a `None` value
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.geckoview.GeckoResult.dispatchLocked(GeckoResult.java:782)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.geckoview.GeckoResult.completeExceptionally(GeckoResult.java:925)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.geckoview.GeckoResult.lambda$thenInternal$6(GeckoResult.java:606)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.geckoview.GeckoResult.$r8$lambda$82f7lYxeXTzVvMgd9wZnqr4Ug34(Unknown Source:0)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.geckoview.GeckoResult$$ExternalSyntheticLambda7.run(D8$$SyntheticClass:0)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.geckoview.GeckoResult.lambda$dispatchLocked$7(GeckoResult.java:797)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.geckoview.GeckoResult$$ExternalSyntheticLambda8.run(D8$$SyntheticClass:0)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at android.os.Handler.handleCallback(Handler.java:958)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at android.os.Handler.dispatchMessage(Handler.java:99)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at android.os.Looper.loopOnce(Looper.java:205)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at android.os.Looper.loop(Looper.java:294)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at android.app.ActivityThread.main(ActivityThread.java:8177)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at java.lang.reflect.Method.invoke(Native Method)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: Caused by: org.mozilla.experiments.nimbus.internal.InternalException: called `Option::unwrap()` on a `None` value
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.experiments.nimbus.internal.NimbusKt.uniffiCheckCallStatus(nimbus.kt:384)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.experiments.nimbus.internal.NimbusKt.access$uniffiCheckCallStatus(nimbus.kt:1)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.experiments.nimbus.internal.NimbusClient.unenrollForGeckoPref(nimbus.kt:3101)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.experiments.nimbus.Nimbus.unenrollForGeckoPref(Nimbus.kt:461)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.fenix.experiments.prefhandling.NimbusGeckoPrefHandler.handleErrors(NimbusGeckoPrefHandler.kt:171)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.fenix.experiments.prefhandling.NimbusGeckoPrefHandler.applyEnrollmentPrefs$lambda$0(NimbusGeckoPrefHandler.kt:323)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.fenix.experiments.prefhandling.NimbusGeckoPrefHandler.$r8$lambda$xCnViHOCuX-0NDvgsfw2YU3Up-Q(Unknown Source:0)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.fenix.experiments.prefhandling.NimbusGeckoPrefHandler$$ExternalSyntheticLambda3.invoke(D8$$SyntheticClass:0)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at mozilla.components.browser.engine.gecko.GeckoEngine.setBrowserPrefs$lambda$1(GeckoEngine.kt:1300)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at mozilla.components.browser.engine.gecko.GeckoEngine.$r8$lambda$STYT63XFj_Wj9bImnp6WV-iEtJY(Unknown Source:0)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at mozilla.components.browser.engine.gecko.GeckoEngine$$ExternalSyntheticLambda19.onValue(D8$$SyntheticClass:0)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	at org.mozilla.geckoview.GeckoResult.lambda$thenInternal$6(GeckoResult.java:593)
03-18 11:54:36.483 17377 17377 E ExceptionHandler: 	... 12 more

Not sure what the idiomatic way is to just continue on in Rust. But it seems acceptable to continue, because the experiment was invalidated.

@ohall-m
Copy link
Contributor Author

ohall-m commented Mar 18, 2026

(This scenario also causes a fatal crash.)

…n Nimbus

A bad unwrap occurs when a multi-pref experiment fails.
@ohall-m
Copy link
Contributor Author

ohall-m commented Mar 20, 2026

Manually checked that the failure isn't happening anymore. (The situation that causes this should also be improved in D288972 on the Fenix side.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nimbus Nimbus, the experimentation platform. rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant