Closed Bug 1707959 Opened 4 years ago Closed 4 years ago

java.lang.illegalArgumentException: vecx must be a finite, non-NaN value NaN on Android Devloper Preview 12

Categories

(GeckoView :: General, defect, P1)

Unspecified
Android
defect

Tracking

(firefox89+ verified, firefox90 verified)

VERIFIED FIXED
90 Branch
Tracking Status
firefox89 + verified
firefox90 --- verified

People

(Reporter: kbrosnan, Assigned: agi)

References

Details

(Whiteboard: [geckoview:m90])

Crash Data

Attachments

(1 file)

From github: https://github.com/mozilla-mobile/fenix/issues/19261.

Steps to reproduce

Browse around, scroll up and down web pages enough to reach the bottom and top of a web page

Expected behavior

Normal operation when reaching the bottom of a webpage

Actual behavior

Screen flickers, Firefox eventually crashes

Device information

  • Device vendor / model and Android version: Google Pixel 4a / Android 12 DP3
  • Firefox for Android version: ? (go to Settings -> About Firefox)
    Nightly 210425 17:01 (Build #2015806731)

d2cb894c-a4be-4603-99e9-5fd7f9fddcfe
java.lang.IllegalArgumentException: vecX must be a finite, non-NaN value NaN


java.lang.IllegalArgumentException: vecX must be a finite, non-NaN value NaN
at android.graphics.RenderNode.stretch(RenderNode.java:725)
at android.widget.EdgeEffect.draw(EdgeEffect.java:633)
at org.mozilla.geckoview.OverscrollEdgeEffect.draw(OverscrollEdgeEffect.java:17)
at org.mozilla.geckoview.OverscrollEdgeEffect.draw(OverscrollEdgeEffect.java:7)
at org.mozilla.geckoview.GeckoView.dispatchDraw(GeckoView.java:3)
at android.view.View.updateDisplayListIfDirty(View.java:21412)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4498)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4471)
at android.view.View.updateDisplayListIfDirty(View.java:21377)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4498)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4471)
at android.view.View.updateDisplayListIfDirty(View.java:21377)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4498)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4471)
at android.view.View.updateDisplayListIfDirty(View.java:21377)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4498)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4471)
at android.view.View.updateDisplayListIfDirty(View.java:21377)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4498)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4471)
at android.view.View.updateDisplayListIfDirty(View.java:21377)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4498)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4471)
at android.view.View.updateDisplayListIfDirty(View.java:21377)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4498)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4471)
at android.view.View.updateDisplayListIfDirty(View.java:21377)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4498)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4471)
at android.view.View.updateDisplayListIfDirty(View.java:21377)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4498)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4471)
at android.view.View.updateDisplayListIfDirty(View.java:21377)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4498)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4471)
at android.view.View.updateDisplayListIfDirty(View.java:21377)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4498)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4471)
at android.view.View.updateDisplayListIfDirty(View.java:21377)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4498)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4471)
at android.view.View.updateDisplayListIfDirty(View.java:21377)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:534)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:540)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:616)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:4334)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4062)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3223)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2057)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8501)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1005)
at android.view.Choreographer.doCallbacks(Choreographer.java:826)
at android.view.Choreographer.doFrame(Choreographer.java:761)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:990)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7695)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:981)

Change performed by the Move to Bugzilla add-on.

Whiteboard: [geckoview:m90?]
Severity: -- → S3
Priority: -- → P2

OP from GitHub
When I say "Firefox eventually crashes" I mean Firefox crashes constantly. And it's not just up and down scrolling. If a page does not fit the window, it will flicker and crash.

Summary: java.lang.illegalArgumentException: vecx must be a finite, non-NaN value NaN → java.lang.illegalArgumentException: vecx must be a finite, non-NaN value NaN on Android Devloper Preview 12
Crash Signature: [@ java.lang.IllegalArgumentException: at android.graphics.RenderNode.stretch(RenderNode.java)]

Agi, do you have access to an Android 12 device to test on?

Flags: needinfo?(agi)

Looks like I can test this on a Pixel 3.

Assignee: nobody → agi
Flags: needinfo?(agi)
Priority: P2 → P1
Whiteboard: [geckoview:m90?] → [geckoview:m90]

I can reproduce the crash on Fenix nightly and Android 12 preview.

I looked into it yesterday. Some notes:

  • This crash is in the overscroll code path
  • Overscroll doesn't seem to be displayed on Android 12 (neither is on my daily driver, on Android 10), from what I can see we try to access some hidden properties in the Android API but fail to do so, I believe newer Androids forbid using reflection like that
  • This appears to be, at least partially, a system bug, from what I can see the inputs are all good
  • I can't seem to be able to get the actual Android code being executed, the source code posted doesn't match what's running (there's no line 633 in EdgeEffect.java or no stretch method in RenderNode) so that makes it a little harder to diagnose.

I'll look into it more this afternoon

I'm starting to understand what's going on. The overscroll effect changed in Android 12 from a grey overlay to a "ripple" effect that affects the entire surface. My theory now is that the SurfaceView that we use doesn't support this effect and thus displays a white image when the effect is being applied, which would explain the flickering. Not sure why the crash yet.

Funnily enough Chrome doesn't support this either. I can see the correct effect being applied on GVE when I select TextureView as the backend.

OK looks like we can use setType to restore the edge effect to the old style so that we can display one: https://developer.android.com/reference/android/widget/EdgeEffect#setType(int)

Android 12 introduces a new type of overscroll effect named TYPE_STRETCH which
stretches the whole surface when overscrolling.

Unforunately, given how it's implemented, SurfaceView does not support this
type of effect, similarly to many other View effects.

The OverscrollEffect is currently crashing on Android 12 builds so we restore the
type to the previous (and only) default to fix the crash.

Note that Overscroll is still not displayed, I'll open a new bug to fix that
part.

This patch also avoids using reflection for setBlendMode on API 29 and later
where an API is actually available. Using reflection to access private APIs is
not available since Android 9 so this code was a no-op before this patch.

See Also: → 1710708
Pushed by asferro@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a53711ef58c9 Set TYPE_GLOW overscroll type on Android 12. r=droeh
Pushed by asferro@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f50820278a98 Set TYPE_GLOW overscroll type on Android 12. r=droeh
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch

Agi, it seems like something we should have fixed in out upcoming 89 Fenix release, could you request an uplift to beta please? Thanks

Comment on attachment 9221700 [details]
Bug 1707959 - Set TYPE_GLOW overscroll type on Android 12.

Beta/Release Uplift Approval Request

  • User impact if declined: Very frequent crashes on Android 12
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: - Open a google search on Firefox for Android on Android 12
  • Scroll all the way down, screen should not flicker
  • Press home button
  • Open FF from the home screen and scroll down immediately, FF should not crash
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This code only runs on Android 12, where we crash pretty frequently without this change, so the inherent risk to make things worse is pretty low. The change is also wrapped around try catch block since it's reflection so in general there's not a lot that can go wrong
  • String changes made/needed:
Flags: needinfo?(agi)
Attachment #9221700 - Flags: approval-mozilla-beta?
Flags: qe-verify+

Comment on attachment 9221700 [details]
Bug 1707959 - Set TYPE_GLOW overscroll type on Android 12.

Approved for the beta branch before 89 RC, thanks.

Attachment #9221700 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [qa-triaged]

Verified as fixed on the Beta 89.0.0-beta.10, RC 88.1.4, and on 5/25 Nightly build with Google Pixel 4XL (Android 12)

Status: RESOLVED → VERIFIED
Flags: qe-verify+
Blocks: 1756530
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: