Closed Bug 1841578 Opened 3 years ago Closed 2 years ago

Crash in [@ java.lang.IllegalArgumentException: at androidx.compose.ui.unit.Constraints$Companion.bitsNeedForSize(Constraints.kt:41)]

Categories

(Firefox for Android :: Homepage, defect, P2)

Unspecified
Android
defect

Tracking

()

RESOLVED FIXED
128 Branch
Tracking Status
firefox115 --- wontfix
firefox116 --- wontfix
firefox117 --- wontfix
firefox118 --- wontfix
firefox119 --- wontfix
firefox120 --- wontfix
firefox121 --- wontfix
firefox122 --- wontfix
firefox123 --- wontfix
firefox126 + wontfix
firefox127 + wontfix
firefox128 + fixed

People

(Reporter: cpeterson, Assigned: 007)

References

(Regression)

Details

(Keywords: crash, regression, Whiteboard: [fxdroid][group1])

Crash Data

Attachments

(1 file)

Crash report: https://crash-stats.mozilla.org/report/index/7db4208a-0b37-49ef-8a9b-687e60230701

This is not a recent crash signature, but its crash volume spiked in 114.

Deep in the stack trace is one mozilla. function:

	at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
	at org.mozilla.fenix.perf.HomeActivityRootLinearLayout.onMeasure(HomeActivityRootLinearLayout.kt:11)

Java stack trace:

java.lang.IllegalArgumentException: Can't represent a size of 2147483646 in Constraints
	at androidx.compose.ui.unit.Constraints$Companion.bitsNeedForSize(Constraints.kt:41)
	at androidx.compose.ui.unit.Constraints$Companion.createConstraints-Zbe2FdA$ui_unit_release(Constraints.kt:18)
	at androidx.compose.ui.unit.ConstraintsKt.Constraints(Constraints.kt:25)
	at androidx.compose.foundation.layout.RowColumnImplKt$rowColumnMeasurePolicy$1.measure-3p2s80s(RowColumnImpl.kt:397)
	at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:42)
	at androidx.compose.foundation.layout.FillModifier.measure-3p2s80s(Size.kt:100)
	at androidx.compose.ui.node.BackwardsCompatNode.measure-3p2s80s(BackwardsCompatNode.kt:15)
	at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:11)
	at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasure$2.invoke(LayoutNodeLayoutDelegate.kt:9)
	at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:64)
	at androidx.compose.runtime.snapshots.SnapshotStateObserver$observeReads$1$1.invoke(SnapshotStateObserver.kt:7)
	at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:44)
	at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:117)
	at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:107)
	at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:136)
	at androidx.compose.foundation.layout.RowColumnImplKt$rowColumnMeasurePolicy$1.measure-3p2s80s(RowColumnImpl.kt:179)
	at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:42)
	at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasure$2.invoke(LayoutNodeLayoutDelegate.kt:9)
	at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:64)
	at androidx.compose.runtime.snapshots.SnapshotStateObserver$observeReads$1$1.invoke(SnapshotStateObserver.kt:7)
	at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:44)
	at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:117)
	at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:107)
	at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:136)
	at androidx.compose.ui.layout.RootMeasurePolicy.measure-3p2s80s(RootMeasurePolicy.kt:49)
	at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:42)
	at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasure$2.invoke(LayoutNodeLayoutDelegate.kt:9)
	at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:64)
	at androidx.compose.runtime.snapshots.SnapshotStateObserver$observeReads$1$1.invoke(SnapshotStateObserver.kt:7)
	at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:44)
	at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:117)
	at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:107)
	at androidx.compose.ui.node.MeasureAndLayoutDelegate.doRemeasure-sdFAvZA(MeasureAndLayoutDelegate.kt:18)
	at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureOnly(MeasureAndLayoutDelegate.kt:27)
	at androidx.compose.ui.node.MeasureAndLayoutDelegate.recurseRemeasure(MeasureAndLayoutDelegate.kt:1)
	at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureOnly(MeasureAndLayoutDelegate.kt:28)
	at androidx.compose.ui.platform.AndroidComposeView.onMeasure(AndroidComposeView.android.kt:94)
	at android.view.View.measure(View.java:23300)
	at androidx.compose.ui.platform.AbstractComposeView.internalOnMeasure$ui_release(ComposeView.android.kt:64)
	at androidx.compose.ui.platform.AbstractComposeView.onMeasure(ComposeView.android.kt:4)
	at android.view.View.measure(View.java:23300)
	at androidx.recyclerview.widget.RecyclerView$LayoutManager.measureChildWithMargins(RecyclerView.java:93)
	at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:60)
	at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:54)
	at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:825)
	at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:61)
	at androidx.recyclerview.widget.RecyclerView.onMeasure(RecyclerView.java:64)
	at android.view.View.measure(View.java:23300)
	at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6928)
	at androidx.coordinatorlayout.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:7)
	at com.google.android.material.appbar.HeaderScrollingViewBehavior.onMeasureChild(HeaderScro...
Assignee: nobody → royang
Whiteboard: [fxdroid]

From crash reporting looks like this exact report is seen first in 114.1.1. Looking at the changes for 114.1.1 there is only one change that could have caused this. It's turning on the Juno onboarding as an experiment.

One thing do note is that all the devices that have this exact crash stack are non-Google devices.

From this discussion it looks like this is a problem with a scrollable column (or scrollview) inside another scrollable column.

Confirmed that 114.1.0 was release but this issue was only first seen in 114.1.1. So highly probably this is related to the Juno onboarding experiment.

Looks like I was wrong. There are similar crashes. The difference is that the line number in the crash stack is different so Sentry separated them out as different crashes. This means this crash is not really crashing more than before.

(In reply to Roger Yang [:royang] from comment #5)

Looks like I was wrong. There are similar crashes. The difference is that the line number in the crash stack is different so Sentry separated them out as different crashes. This means this crash is not really crashing more than before.

Socorro shows that this crash signature (even when ignoring line numbers) occurred before v114, but spiked in v114. It jumped from 8 reports in v113 to 639 reports in v114:

https://crash-stats.mozilla.org/search/?signature=~Exception%3A%20at%20androidx.compose.ui.unit.Constraints%24Companion.bitsNeedForSize%28&product=Fenix&product=Focus&date=%3E%3D2023-01-05T16%3A50%3A00.000Z&date=%3C2023-07-05T16%3A50%3A00.000Z&_facets=signature&_facets=version&_facets=major_version&_facets=cpu_arch&_facets=android_version&_sort=-date&_columns=date&_columns=signature&_columns=product&_columns=version&_columns=build_id&_columns=platform#facet-major_version

About 82% of the reports are from API 26 (Android 8.0) devices.

Rahul says we updated recyclerview from 1.2.1 to 1.3.0 in 114 (bug 1822447), so this crash might be a regression in recyclerview 1.3.0.

See Also: → 1822447

:royang have there been any updates on the investigation, do we know the cause?

Flags: needinfo?(royang)

There is a discussion here. It seems like Google is actively working on a fix. Looks like currently the only way to fix this is to move back to 1.3.1. We first moved from 1.3.1 to 1.4.2 first in v114, which match up to the crash reports except for the Focus v111 crashes.

Do we/can we/should we go back down to compose 1.3.1 until Google fix this? Adding Noah for some insights.

Flags: needinfo?(royang)
Flags: needinfo?(nbond)
Flags: needinfo?(cpeterson)

I would check, if you haven't already/if it's possible to reproduce, if 1.3.1 (or the newer 1.3.x dot version) fixes the issue.

I originally bumped the version to 1.4.2 in Bug 1826457 to fix a different crash in the Tabs Tray rewrite. So if we need to bump down the version, it will block the Tabs Tray rewrite until Google introduces another 1.4 dot release with a patch.

https://developer.android.com/jetpack/androidx/releases/compose-ui

Flags: needinfo?(nbond)

:cpeterson I agree with :007 that we shouldn't downgrade. Is it acceptable that we wait for Google's fix?

(In reply to Roger Yang [:royang] from comment #11)

:cpeterson I agree with :007 that we shouldn't downgrade. Is it acceptable that we wait for Google's fix?

You know the details better than I do, but that sounds reasonable if temporarily downgrading Compose UI would be too invasive. In the meantime, we should keep an eye on the crash volume.

I see that Google's bug is priority P1 and Status "In Progress", though they haven't given an ETA. If they don't release a fix soon (when?), we may want to revisit the downgrade decision.

https://issuetracker.google.com/issues/283090850

Flags: needinfo?(cpeterson)
Regressed by: 1826457

do we have a timeline for how long we want to wait for Google to fix this?

Flags: needinfo?(nbond)
Flags: needinfo?(nbond) → needinfo?(royang)

No estimate. Looks like a Google developer only started working on this issue July 5th 2023. We'll have to wait till the compose update before this can be fixed. No workaround from our end. Since if we downgrade we re-introduce a different crash. I've subscribed to the Google issue and if there is any update, I'll update here as well.

Flags: needinfo?(royang)
Priority: P3 → P2
See Also: 1822447 →

Set release status flags based on info from the regressing bug 1826457

Google just fixed the bug upstream today:

https://issuetracker.google.com/issues/283090850#comment17

They didn't say which compose-ui version will include the fix. I see there are new 1.5.0 and 1.6.0-alpha versions of compose-ui available, but neither includes the fix yet. Hopefully this fix will make the final 1.6.0 release. Unfortunately, Google appears to release compose-ui quarterly, so the final 1.6.0 probably won't be released until Q4.

https://developer.android.com/jetpack/androidx/releases/compose-ui#version_16_2

Mihai, I see you updated Compose from 1.4.2 to 1.5.0 last week in bug 1850473. Google announced that their bug fix for this crash is now available in Compose 1.5.1 (and 1.6.0-alpha05), so we should update Fenix from Compose 1.5.0 to 1.5.1 soon.

https://issuetracker.google.com/issues/283090850#comment22

Flags: needinfo?(mcarare)
See Also: → 1850473
Depends on: 1851961

The update to Compose 1.5.1 patch has landed in main.

Flags: needinfo?(mcarare)

Since:

  1. this fix is a third-party library update and not just a crash fix in our own code
  2. and the crash volume isn't super high (or at least lower than some of our other current top crashes)

we can let this fix ride the trains without uplifting to Beta or a dot release.

Reopening this bug because we're still getting crash reports from versions >= 119.

Also, the crash volume roughly doubled on 2023-10-01. Maybe that was caused releasing Fx 118 on 2023-09-26 or by updating to Compose 1.5.2 on 2023-09-27 in bug 1855524? No action needed at this time since we can't downgrade Compose. :(

Airbnb and SoundCloud people commenting on the Google issue confirm they can still reproduce the crash in Compose 1.5.3:

https://issuetracker.google.com/issues/283090850#comment27

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
See Also: → 1855524

Google issue https://issuetracker.google.com/issues/283090850 was resolved as "fixed"; the new issue tracking these crashes is https://issuetracker.google.com/issues/300280216.

The bug is linked to a topcrash signature, which matches the following criterion:

  • Top 10 AArch64 and ARM crashes on beta

:mcarare, could you consider increasing the severity of this top-crash bug?

For more information, please visit BugBot documentation.

Flags: needinfo?(mcarare)
Keywords: topcrash

https://issuetracker.google.com/issues/303737196 with a similar stacktrace is marked as fixed in the next release. We should revisit the crash stats after we upgrade.

Severity: S3 → S2
Flags: needinfo?(mcarare)

(In reply to Mihai Adrian Carare [:mcarare] from comment #24)

https://issuetracker.google.com/issues/303737196 with a similar stacktrace is marked as fixed in the next release. We should revisit the crash stats after we upgrade.

That bug was marked fixed on 2023-11-30. Since then, Google has published more three minor versions of 1.5 and two more 1.6.0-beta releases, but none of their release notes mention issue 303737196. So hopefully this fix will be included in the final 1.6.0 release.

https://developer.android.com/jetpack/androidx/releases/compose-compiler

Crash Signature: [@ java.lang.IllegalArgumentException: at androidx.compose.ui.unit.Constraints$Companion.bitsNeedForSize(Constraints.kt:3)] [@ java.lang.IllegalArgumentException: at androidx.compose.ui.unit.Constraints$Companion.bitsNeedForSize(Constraints.kt:41)] → [@ java.lang.IllegalArgumentException: at androidx.compose.ui.unit.Constraints$Companion.bitsNeedForSize(Constraints.kt)] [@ java.lang.IllegalArgumentException: at androidx.compose.ui.unit.Constraints$Companion.bitsNeedForSize(Constraints.kt:3)] [@ java…

Based on the topcrash criteria, the crash signatures linked to this bug are not in the topcrash signatures anymore.

For more information, please visit BugBot documentation.

Keywords: topcrash

Since this is an S2, any chance we will see a fix and uplift request for Fx123 before release?

Flags: needinfo?(mcarare)

The fix is in the unreleased compose material 1.7.0 version, which is still in the alpha release stage, so I don't expect to see it soon.

Depends on: 1876398
Flags: needinfo?(mcarare)
Whiteboard: [fxdroid] → [fxdroid][group1]

The crash volume spiked in Fenix 126. Could you investigate or redirect the request?

Flags: needinfo?(mcarare)

I am not actively working on this since we can't fix the crash in our code and we are expecting it to be fixed on the API side. The last info suggests that the crashes would be fixed in 1.7.0 ( still in beta stage as of May 14, 2024).

I am also unassigning myself if someone else wants to take over a separate investigation thread.
Will comeback to revisit this as soon as we land the Compose upgrade.

Assignee: mcarare → nobody
Flags: needinfo?(mcarare)

See bug for full info. TLDR: BoxWithConstraints is likely causing crashes when paired with our weird hybrid RecyclerView + Compose implementation of the Homepage

Copied from Slack:

Based on what I can see on Sentry, it kinda looks like it’s crashing on Homepage.

  • Within this stack trace there’s a RecyclerView call before compose code
    • Only the Homepage is structured like this (it has an underlying Recyclerview with individual components written in Compose)
  • With the breadcrumbs I’m seeing, the Homepage is being navigated to.
  • One of common culprits for a stack trace like this is a component called BoxWithConstraints and the RecentlyVisited composable on the homepage uses this.

If this hypothesis were to be true, we might be able to fix this by a small rewrite of RecentlyVisited to not use BoxWithConstraints. The homepage also shouldn’t be in this weird limbo state of using a RecyclerView with Compose; we should prioritize finishing that migration.

With regards to Tabs Tray showing up in some of the breadcrumbs, the only reasonable theory I have is that:

  • User goes to home page
  • User opens the Tabs Tray while the homepage is incomplete
  • The homepage tries to finish rendering
  • Crash :explode:

Tracking this due to the volume spike in 126.

Noah, the attached wip patch looks risky for 126 but might be ok for 127 beta after some time in nightly.
Any updates on the Comment 32, were you able to reproduce or do you still have the same theory on the cause?
Is there anything we can do for 126 in the meantime? (e.g. revert/disable whatever introduce the spike in 126)

The bug is marked as tracked for firefox126 (release), tracked for firefox127 (beta) and tracked for firefox128 (nightly). However, the bug still isn't assigned.

:towhite, could you please find an assignee for this tracked bug? Given that it is a regression and we know the cause, we could also simply backout the regressor. If you disagree with the tracking decision, please talk with the release managers.

For more information, please visit BugBot documentation.

Flags: needinfo?(towhite)
Assignee: nobody → nbond
Flags: needinfo?(towhite)

(In reply to Donal Meehan [:dmeehan] from comment #33)

Tracking this due to the volume spike in 126.

Noah, the attached wip patch looks risky for 126 but might be ok for 127 beta after some time in nightly.
Any updates on the Comment 32, were you able to reproduce or do you still have the same theory on the cause?
Is there anything we can do for 126 in the meantime? (e.g. revert/disable whatever introduce the spike in 126)

I'm going to discuss this with the primary reviewer tomorrow when he's back from PTO, so I'll hopefully have a better update EOD (Pacific time) tomorrow.

Unfortunately, I have yet to reproduce the crash, so the fix is still speculative. I agree with letting it bake for a little in Nightly before uplifting to Beta, if the proposed patch is approved. There is nothing we can do for 126, since the crash was seemingly spurred on by a Compose library version bump last year and more started spiking recently.

Flags: needinfo?(nbond)

:007 do you know why the crash volume has dropped in beta?
Fx127 is lower than when Fx126 was in beta, is there a change in Fx127 that could explain the drop?

Flags: needinfo?(nbond)
See Also: → 1896955

I don't have any immediate hypotheses why the volume would have dropped in 127. I plan on moving forward with the above patch though and it'll land this week.

Flags: needinfo?(nbond)
Attachment #9402344 - Attachment description: WIP: Bug 1841578 - Refactor `RecentlyVisited` to no longer use `BoxWithConstraints` → Bug 1841578 - Refactor `RecentlyVisited` to no longer use `BoxWithConstraints`

I added a see-also for bug 1896955 -- its crash-volume-spike seems to match the timeline of this bug here, and both of them are IllegalArgumentException, so it seems like they might have a common/similar root cause. (Perhaps they should be duped to avoid redundant investigations/work?)

(pollymce ran across a Google bug report with some relevant info in bug 1896955 comment 7, too.)

(In reply to Ryan VanderMeulen [:RyanVM] from bug 1896955 comment #8)

Hard to judge for sure, but we did update to BOM 2024.04.01 in bug 1892160 for 127+ it looks like maybe the crash rate is lower on Beta 127 vs. Beta 126?

Seems like this comment from the other bug is more clearly showing in this one. We might want to consider uplifting the BOM update for the next Android dot release. Should do so cleanly.

See Also: → 1892160
Pushed by nbond@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e90d0b920b34 Refactor `RecentlyVisited` to no longer use `BoxWithConstraints` r=android-reviewers,rsainani
Status: REOPENED → RESOLVED
Closed: 3 years ago → 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch

The patch landed in nightly and beta is affected.
:007, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox127 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(nbond)

(In reply to BugBot [:suhaib / :marco/ :calixte] from comment #42)

The patch landed in nightly and beta is affected.

Notably, it looks like crash volume on beta127 with this signature is extremely low, possibly for reasons discussed in bug 1896955 comment 8 (bug 1892160 having landed there, possibly mitigating this issue).

So it's possible beta127 is not-really-affected, at least by the recent giant crash spike, which might be relevant to the beta-uplift cost/benefit for the patch that landed here.

Flags: needinfo?(nbond)
See Also: → 1916150
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: