Crash in [@ java.lang.IllegalStateException: at androidx.fragment.app.Fragment.getParentFragmentManager(Fragment.java)]
Categories
(Firefox for Android :: Tabs, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | unaffected |
| firefox163 | --- | unaffected |
| firefox164 | + | fixed |
People
(Reporter: clouseau-bot, Unassigned, NeedInfo)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: crash, regression)
Crash Data
Crash report: https://crash-stats.mozilla.org/report/index/feb6efff-77e9-4628-bf38-8aad00261205
Top 10 frames:
0 androidx.fragment.app.Fragment getParentFragmentManager
1 androidx.navigation.fragment.NavHostFragment$Companion findNavController
2 androidx.navigation.fragment.FragmentKt findNavController
3 org.mozilla.fenix.tabgroups.strip.SelectedTabNavigationKt$observeSelectedTabForNavigation$1$2 emit mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tabgroups/strip/SelectedTabNavigation.kt:47
4 org.mozilla.fenix.tabgroups.strip.SelectedTabNavigationKt$observeSelectedTabForNavigation$1$2 emit mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tabgroups/strip/SelectedTabNavigation.kt:43
5 kotlinx.coroutines.flow.FlowKt__LimitKt$drop$2$1 emit
6 kotlinx.coroutines.flow.DistinctFlowImpl$collect$2 emit
7 kotlinx.coroutines.flow.FlowKt__TransformKt filter
8 org.mozilla.fenix.tabgroups.strip.SelectedTabNavigationKt$observeSelectedTabForNavigation$1$invokeSuspend$$inlined$map$1$2 emit org/mozilla/fenix/tabgroups/strip/Emitters.kt:217
9 kotlinx.coroutines.flow.FlowKt__ChannelsKt emitAllImpl$FlowKt__ChannelsKt
Filed because this signature's crash volume spiked. 8 reports from 6 distinct installations on the nightly build of 2026-12-04 (buildid 20261204215948); none of the preceding 3 build-days had any, and no build in the 21 days before had any report of it. That is an appearance from zero over the loudest of the preceding build-days and of this signature's builds over the 21 days before (Clouseau's bar is 3x, and the Poisson excess of the day against that baseline is z = 4.56, bar 3.62). This signature is new on nightly: crash-stats has no report of it there before this build.
Crash-stats counts for this signature on nightly when this was posted:
| Builds of the 21 days before | Builds of 2026-12-04 | |
|---|---|---|
| Reports | 0 | 8 |
| Distinct install times | 0 | 6 |
| Reports from the busiest install time | 0 | 2 (25%) |
Clouseau analysis (automated -- nothing below was checked by a human; a claim it could not ground is deliberately absent):
This spike is a Java IllegalStateException thrown from Fragment.getParentFragmentManager() when findNavController() is called in the tab-group-strip selected-tab observer (observeSelectedTabForNavigation, SelectedTabNavigation.kt:47). The observer is collected through Store.flowScoped, which creates its own CoroutineScope that the fragment's view lifecycle never cancels. When the view is destroyed the store subscription is only unsubscribed, so a selected-tab change already queued on Dispatchers.Main can still run against a fragment that has left its FragmentManager. The signature first appeared in the 2026-12-04 Nightly, the same build where bug 2100039 (b266614f9ed8) turned the tab group strip on by default on Nightly. That change switched this observer on for every Nightly user; the observer itself landed in November behind the flag. Suggested fix: cancel the scope that flowScoped returns when the view is destroyed (or collect in viewLifecycleOwner.lifecycleScope), and guard the navigation with fragment.isAdded / a check on the view lifecycle state.
Suspected regressor (medium confidence): b266614f9ed8 (bug 2100039) by :calu.
The diff changes the tabGroupsStrip Nimbus default to enabled: true on the nightly channel in nimbus.fml.yaml, and adds Config.channel.isDebug to TabManagementFeatureHelper. shouldShowTabGroupsStrip is the gate in front of the observeSelectedTabForNavigation calls in HomeFragment.kt:586-593 and BaseBrowserFragment.kt:1739-1745, so this change turned the crashing observer on for Nightly users. Strictly, the flip exposes a latent lifecycle defect in the observer that landed in 1fade594568d (bug 2071335, 2026-11-05).
Possible path to the crash:
Mechanism (observed/inferred, medium): findNavController() → NavHostFragment.findNavController → Fragment.getParentFragmentManager() throws IllegalStateException, called from the collect lambda at SelectedTabNavigation.kt:47 on the main looper. The throw most likely means the fragment is no longer attached to a FragmentManager (inferred; the exception message is in a protected annotation that was not read).
Path (inferred, medium):
HomeFragmentorBaseBrowserFragmentcallsobserveSelectedTabForNavigationwhenshouldShowTabGroupsStripis true, which now holds by default on Nightly.- It calls
store.flowScoped(fragment.viewLifecycleOwner, Dispatchers.Main), which creates a standaloneCoroutineScope(SupervisorJob() + dispatcher); the caller discards that scope and never cancels it. - When the view lifecycle reaches
ON_DESTROY,SubscriptionLifecycleBinding.onDestroyonly callssubscription.unsubscribe(); the collecting coroutine and its conflated buffer stay alive. - A
selectedTabIdchange that was sent into the buffer before teardown is delivered later throughDispatchedTask.runon the main thread. - The collector calls
fragment.findNavController()on a fragment that has already left itsFragmentManager, andgetParentFragmentManager()throws.
Trigger (inferred, low): selecting a tab from the strip (or any selected-tab change) at the moment the fragment is being replaced. One example is the home↔browser navigation that this observer, or its twin in the other fragment, triggers itself. The user action that causes it is not identified.
Checked:
- The crashing frame #3 is
fragment.findNavController().nav(currentDestinationId, directions)inside thecollectofobserveSelectedTabForNavigation, collected viastore.flowScoped(fragment.viewLifecycleOwner, Dispatchers.Main). (mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tabgroups/strip/SelectedTabNavigation.kt@f3e6fd5563fb:38-48) flowScopedreturns a newCoroutineScope(SupervisorJob() + dispatcher)that is not tied to the owner's lifecycle, and the lifecycle binding only pauses on stop and callsunsubscribe()on destroy. (mobile/android/android-components/components/lib/state/src/main/java/mozilla/components/lib/state/ext/StoreExtensions.kt@f3e6fd5563fb:138-217)- Both callers invoke the observer only when
requireComponents.settings.shouldShowTabGroupsStripis true. (HomeFragment.kt@f3e6fd5563fb:586-593; BaseBrowserFragment.kt@f3e6fd5563fb:1737-1746) b266614f9ed8(bug 2100039, in this build's pushlog) sets thetabGroupsStripdefault toenabled: truefor the nightly channel. (mcp__patch__diff b266614f9ed8: nimbus.fml.yaml +1058-1067, TabManagementFeatureHelper.kt +55)SelectedTabNavigation.kthas a single history entry,1fade594568d(bug 2071335, 2026-11-05), so the observer code is a month older than the spike and unchanged in this window. (mcp__history__file_history SelectedTabNavigation.kt)- The signature was first seen in build 20261204215948 (8 reports from 6 installations on that build-day, none in the prior 21 days) and appears only on nightly. (brief: spike numbers and signature age)
- The representative report is a Fenix 164.0a1 parent-process crash on Android 37 (samsung SM-A356E), uptime 8667 s; there is no minidump thread list, and no
moz_crash_reasonorproto_signaturevalues exist for the 10 reports. (mcp__crashstats__report feb6efff-77e9-4628-bf38-8aad00261205; facets moz_crash_reason and proto_signature, 14d) - The spike is caused by the observer that the strip flag turned on, not by a change to the crashing code itself. [inferred, medium confidence] (Combines the onset build, the diff of b266614f9ed8, and the unchanged file history of SelectedTabNavigation.kt)
Alternatives considered:
- Hardware fault / bit flips: not supported -- the brief reports 0% bit-flip and 0% Raptor Lake share, and this is a Java exception with a coherent stack.
- A recent edit to
SelectedTabNavigation.ktin this window: ruled out -- its only history entry is1fade594568dfrom 2026-11-05. - A Nimbus experiment or rollout: disfavored -- the brief reports no live fenix rollout or experiment on this channel in the 168 h before the first report; the default change ships in the build itself.
- Other changesets in the pushlog (necko, gfx, desktop, WPT, other Android fixes): not supported -- none touch the tab-group strip or these fragments' navigation path.
- Signature rename of an older crash: unresolved -- the obfuscated
kf2.aname could be re-mapped by R8 between builds, but the stack runs through code that only became active in this build.
Worth checking first:
- Exact exception message (e.g. 'Fragment ... not associated with a fragment manager'): read the protected
JavaExceptionannotation on these reports to confirm the fragment was detached rather than failing some other check. - Which fragment (Home or Browser) and which user action leads to the delayed delivery: the
Breadcrumbsannotation, or a test that selects a strip tab while home↔browser navigation is in progress, would show this; a Robolectric/instrumented test can deliver a queued store state afteronDestroyViewto reproduce it. - Whether a fix should also change
flowScopedcallers elsewhere: audit other callers that discard the returned scope and touch the fragment insidecollect. OnlyobserveSelectedTabForNavigationwas inspected in this run.
:calu, 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.
Comment 1•11 hours ago
|
||
Set release status flags based on info from the regressing bug 2100039
Updated•6 hours ago
|
Comment 2•6 hours ago
|
||
Requested backout of the regressor
Comment 3•6 hours ago
|
||
Setting Fx164 as fixed since the regressor, Bug 2100039, was backed out
Description
•