Skip to content

[Bug]: Earn (Money) onboarding crashes the app on Android when tapping the X close button #31166

@vinnyhoward

Description

@vinnyhoward

Describe the bug

Tapping the X (close) button on the Earn onboarding screen consistently crashes the app on Android. The screen begins navigating back to wallet home, and within ~0.5-1 seconds (during the navigation transition) the app aborts via a native SIGABRT. Same crash class as Sentry issue METAMASK-MOBILE-5VF9 / TMCU-853.

The underlying bug is in rive-react-native: when the Earn onboarding screen unmounts mid-animation, Android releases the SurfaceView's backing Surface, but the Rive native worker thread is still alive and queues its next prepareForDraw() against the released Surface. Java throws IllegalStateException, and rive's JNI layer doesn't call ExceptionClear() before making the next JNI call (NewGlobalRef), violating ART's JNI rules and aborting the process.

Expected behavior

Tapping X should dismiss the Earn onboarding screen and return the user to wallet home without crashing.

Screenshots/Recordings

x_crash.mov

Steps to reproduce

  1. Fresh install of the app (or a state where the Earn onboarding has not yet been seen) on an arm64 Android device or emulator
  2. Complete primary onboarding through to wallet home
  3. Tap the Money / Earn tab — the Earn onboarding overlay appears with the Rive animation
  4. Tap the X (close button) in the top-right of the onboarding overlay (NOT the Continue button)
  5. App begins navigating back; crashes within ~0.5-1 seconds

Error messages or log output

Abort message: 'JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception
java.lang.IllegalStateException: Surface has already been released.
  at android.view.Surface.checkNotReleasedLocked() (Surface.java:876)
  at android.view.Surface.lockCanvas(android.graphics.Rect) (Surface.java:554)
in call to NewGlobalRef'

backtrace:
  #00 abort
  #01 art::Runtime::Abort
  #08 art::CheckJNI::NewRef
  #09 rive_android::CanvasWorkerImpl::prepareForDraw
  #10 rive_android::WorkerImpl::doFrame
  #12 rive_android::WorkerThread::threadMain

Where was this bug found?

Internal release testing

Version

7.81.0

Build number

4823

Build type

None

Device

  • Galaxy A32 (Android 13, arm64)
  • Pixel 9 Pro XL emulator (Android, arm64)

Operating system

Android

Additional context

x_crash.txt

Severity

No response

Metadata

Metadata

Assignees

Labels

RCA-neededIssue root cause analysis neededSev1-highAn issue that may have caused fund loss or access to wallet in the past & may still be ongoingregression-RC-7.81.0Regression bug that was found in release candidate (RC) for release 7.81.0release-7.82.0Issue or pull request that will be included in release 7.82.0release-blockerThis bug is blocking the next releaseta-needs-engineer-escalationTriage-Agent - Applied when confidence is below thresholdta-triagedteam-earnteam-mobile-platformMobile Platform teamtype-bugSomething isn't working

Type

No fields configured for Bug.

Projects

Status
To be triaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions