Crash in [@ kotlin.UninitializedPropertyAccessException: at mozilla.telemetry.glean.private.TimingDistributionMetricType.getInner(TimingDistributionMetricType.kt:8)]
Categories
(Data Platform and Tools :: Glean: SDK, defect, P1)
Tracking
(firefox161+ affected, firefox162+ fixed, firefox163+ fixed)
People
(Reporter: clouseau-bot, Assigned: janerik)
References
(Blocks 2 open bugs)
Details
(4 keywords)
Crash Data
Attachments
(4 external files)
Crash report: https://crash-stats.mozilla.org/report/index/c308ac89-4241-4784-bd4e-080360261108
Top 10 frames:
0 mozilla.telemetry.glean.private.TimingDistributionMetricType getInner mozilla/telemetry/glean/private/TimingDistributionMetricType.kt
1 mozilla.telemetry.glean.private.TimingDistributionMetricType start mozilla/telemetry/glean/private/TimingDistributionMetricType.kt
2 org.mozilla.fenix.components.metrics.AdjustMetricsService buildAdjustConfig mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/AdjustMetricsService.kt
3 org.mozilla.fenix.components.metrics.AdjustMetricsService ensureInitialized mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/AdjustMetricsService.kt
4 org.mozilla.fenix.components.metrics.AdjustMetricsService$start$1 invokeSuspend mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/metrics/AdjustMetricsService.kt
5 kotlin.coroutines.jvm.internal.BaseContinuationImpl resumeWith
6 kotlinx.coroutines.DispatchedTask run
7 kotlinx.coroutines.internal.LimitedDispatcher$Worker run
8 kotlinx.coroutines.scheduling.TaskImpl run
9 kotlinx.coroutines.scheduling.CoroutineScheduler$Worker run
There are 16 crashes (from 7 installations) in nightly 161 starting with buildid 20261105050539.
This signature is new: its first report anywhere is in build 20261031095059 (2026-10-31), 5 days before the build above.
Clouseau analysis (automated). The mechanism below fits the evidence but is not proven end-to-end:
Fenix probably crashes at startup when AdjustMetricsService starts the Glean timer adjustAttributionTime and the Glean Kotlin TimingDistributionMetricType reads its still-uninitialized lateinit inner.
AdjustMetricsService.startlaunches a coroutine onDispatchers.IOthat callsensureInitializedand thenbuildAdjustConfigwhen no Adjust attribution is stored yet.buildAdjustConfigcallssetAttributionChangedListener, which callsAdjustAttribution.adjustAttributionTime.start().- Changeset cb62c451a11f moved the Glean Android library from 70.3.0 to 71.0.0, which probably changed when
TimingDistributionMetricType.inneris assigned (for example, only once Glean is initialized). - On this IO-thread path,
start()reachesgetInner()beforeinneris set, and Kotlin throwsUninitializedPropertyAccessException.
Frames #0–#4 match this chain, and the fenix code in it was last changed on 2026-10-13, so the variable is the Glean library. Step 3 is inferred from domain and timing (Glean 71.0.0 landed 2026-10-29 and the signature first appeared in build 20261031), not read from Glean source, which is not in mozilla-central. The update may only have exposed an older ordering issue, where Adjust telemetry is touched before Glean initialization.
The signature first appeared in build 20261031, and per-day counts are zero before 10-31. The Glean 71.0.0 bump (cb62c451a11f) landed on 2026-10-29, just before that. No Nimbus rollout went live in that period, and the bit-flip and Raptor Lake shares are 0%. The 2026-11-05 pushlog window comes after first appearance and contains nothing in Glean or Adjust.
Starting point — NOT a suspected cause: cb62c451a11f (gh) (bug 2085018) by :janerik.
This changeset did not land in this build's pushlog window, so there is no evidence here that the crash is a recent regression from it; it is named only as the closest thing found on the crash path. If you know where this actually comes from, that correction is the most useful thing you could leave on this bug.
Impact
The parent process crashes, so the whole browser closes.
Possible fixes
- In Glean Kotlin, make
TimingDistributionMetricType.startsafe to call beforeinneris assigned (lazy init or queueing, as other metric types do pre-init). - In fenix, defer
AdjustMetricsService.start'sensureInitializeduntil afterGlean.initializehas run. - Defensively catch the exception around
adjustAttributionTime.start()insetAttributionChangedListeneruntil a Glean fix ships.
How to confirm
Diff the Glean Kotlin TimingDistributionMetricType between v70.3.0 and v71.0.0 for the introduction of lateinit var inner, then reproduce by starting Fenix with marketing telemetry enabled and no stored Adjust attribution, with AdjustMetricsService.start racing ahead of Glean.initialize.
Code references:
What the automated skeptic pass checked
In its own words (a pass means the check succeeded, which is not always support for the conclusion):
- unverifiable mechanism — The Glean Kotlin bindings (
TimingDistributionMetricType.kt) are not in mozilla-central (searchfox finds no definition), so I could not confirm that v71.0.0 introduced or changed thelateinit inner. The link rests on domain (the exception is thrown inside the Glean library this changeset swaps) and timing (landed 2026-10-29, signature first seen in build 20261031). - unverifiable alt_adjust_sdk — The Adjust SDK 5.8.1 bump landed the same day, but the exception is raised in Glean's
getInner, not in Adjust code, so it is less likely.AdjustMetricsService.ktwas last changed on 2026-10-13 (3881151eace9), well before first sighting. - fail window — This and every other 2026-11-05 pushlog candidate (including the Nimbus 'feature-flip' changes and the application-services vendor bump f528980adbd1) is after the signature's first sighting in build 20261031, and none touches Glean Kotlin, Adjust or
AdjustMetricsService. They are noise for this crash.
:janerik, can you have a look please?
Filed automatically by Clouseau with an LLM, from a submitted crash report: not an independent Mozilla discovery
Filed automatically by Clouseau, which analyses nightly crashes with an LLM. Nothing above was written or checked by a human. Please close it as INVALID if it is wrong — that is useful feedback, not a nuisance.
This is not an independent Mozilla discovery: the crash is known here only because somebody submitted the crash report linked at the top. If this duplicates an existing report, please resolve THIS bug as the duplicate and leave the credit with the earlier reporter.
| Assignee | ||
Updated•12 days ago
|
Comment 2•12 days ago
|
||
(via GitHub webhook, authenticated as shared-secret)
| Assignee | ||
Updated•11 days ago
|
| Assignee | ||
Comment 3•10 days ago
|
||
badboy merged PR [mozilla/glean]: Bug 2090806 - Kotlin: Don't do intialization of a timing distribution metric on the dispatcher (#3778) in 919fb8a.
The patch landed upstream. It will land in the next release, which I'll try to get out quickly. Leaving this open for tracking until then.
| Comment hidden (duplicate) |
| Reporter | ||
Updated•8 days ago
|
| Assignee | ||
Comment 5•8 days ago
|
||
Clouseau, can you please stop reposting things that are already tackled? Thank you.
Updated•3 days ago
|
Updated•3 days ago
|
Comment 6•2 days ago
|
||
Jan-Erik, this is a top crash on release, here is Claude suggestion for a safe fix on the release channel we could include in next week dot release:
Cause: a regression in Glean 71.0.0, confirmed from the Glean source. In v70.3.0, inner was by lazy, so it was created on first use and could not fail. In v71.0.0 it became a lateinit var, set by a task queued on Glean's Dispatchers.Delayed. That task only runs after Glean.initialize drains the pre-init queue. AdjustMetricsService.start() starts a coroutine on Dispatchers.IO that calls ensureInitialized → buildAdjustConfig → setAttributionChangedListener → AdjustAttribution.adjustAttributionTime.start(). That call can run before the queued task does, so start() throws.
This only happens while no Adjust attribution is stored, because alreadyKnown(settings) returns false. For those users it repeats on every launch.
Upstream fix: Jan-Erik's PR #3778 (commit 919fb8a) restores lazy creation in getInner(). It is not in any Glean release: it is listed under "Unreleased" in the changelog and is in neither v71.1.0 nor v71.2.0. It is planned for v72.0.0 (bug 2094550), which waits on bug 2093447 and needs cross-team coordination.
Release (161.0.1) and beta (162) both use Glean 71.0.0. Main uses 71.2.0, which also lacks the fix, so 163 is affected too.Recommended option: a small Fenix-only workaround, uplifted to release and beta
In setAttributionChangedListener (AdjustMetricsService.kt), stop using the Glean timer and measure the time in Fenix instead. accumulateSingleSample() goes through Dispatchers.Delayed in the same queue order as the constructor's task, so it is safe before Glean is initialized:
private fun setAttributionChangedListener(config: AdjustConfig, settings: Settings) { val startTime = SystemClock.elapsedRealtime() config.setOnAttributionChangedListener { AdjustAttribution.adjustAttributionTime.accumulateSingleSample( SystemClock.elapsedRealtime() - startTime, ) ...
What do you think?
| Assignee | ||
Comment 7•2 days ago
|
||
That would work. We can leave a TODO on it to switch it back once bug 2094550 landed.
(I didn't realize this hit release already, my bad).
Are you doing that patch and I can r+ it or the other way around?
Comment 8•2 days ago
|
||
Please do the patch, I am not a developer :D Thanks!
| Assignee | ||
Comment 9•2 days ago
|
||
(In reply to Pascal Chevrel (relman team) -> :pascalc from comment #8)
Please do the patch, I am not a developer :D Thanks!
You can be! (I'll do it)
| Assignee | ||
Comment 10•2 days ago
|
||
| Assignee | ||
Comment 11•2 days ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D346435
Updated•2 days ago
|
Comment 12•2 days ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined/Reason for urgency: Crashes on Android in Release and Beta.
- Code covered by automated testing?: no
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing: -
- Risk associated with taking this patch: low
- Explanation of risk level: Changing to a Glean API we know is not impacted by the bug (it's used in other places in this way).
- String changes made/needed?: -
- Is Android affected?: yes
Comment 13•2 days ago
|
||
firefox-release Uplift Approval Request
- User impact if declined/Reason for urgency: Crashes on Android in Release and Beta.
- Code covered by automated testing?: no
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing: -
- Risk associated with taking this patch: low
- Explanation of risk level: Changing to a Glean API we know is not impacted by the bug (it's used in other places in this way).
- String changes made/needed?: -
- Is Android affected?: yes
| Assignee | ||
Comment 14•2 days ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D346435
Comment 15•2 days ago
|
||
Updated•2 days ago
|
Comment 16•2 days ago
|
||
| bugherder | ||
Updated•1 day ago
|
Updated•1 day ago
|
Comment 17•1 day ago
|
||
| uplift | ||
Description
•