Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile Replay crashes on SDK init in Release mode on Android devices #3990

Closed
5 of 11 tasks
LucianGalea opened this issue Aug 5, 2024 · 14 comments · Fixed by getsentry/sentry-java#3628
Closed
5 of 11 tasks

Comments

@LucianGalea
Copy link

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 5.27.0

react-native version: 0.73.2

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

Configuration:

(@sentry/react-native)

Sentry.init({
  dsn: 'https://...',

  _experiments: {
    replaysSessionSampleRate: 1.0,
    replaysOnErrorSampleRate: 1.0,
  },

  integrations: [
    Sentry.mobileReplayIntegration({
      maskAllText: false,
      maskAllImages: false,
      maskAllVectors: false,
    }),
  ],
});

I have the following issue:

On React Native 0.73.2, replays on Google Pixel Pro 6 don't work. On top of that, reloading the app will freeze it.

Steps to reproduce:

  • Initialise a project with RN 0.73.2: npx @react-native-community/cli@latest init RNSentryTest --version 0.73.2
  • Add sentry: npx @sentry/wizard@latest -s -i reactNative

Actual result:

On Google Pixel 6 Pro (Android version 14), no replays will be captured. On top of that, reloading the app will freeze. Killing the app and restarting it fixes the freeze.

NOTE: disabling the replays doesn't fix the freeze, so it's probably not related to that.

Expected result:

Replays should be saved.
Reload shouldn't freeze.

@franblanco95
Copy link

I have the same problem on Android.. The app crashes when is downloaded from the playstore. From the emulator works ok.

@kahest
Copy link
Member

kahest commented Aug 7, 2024

Thank you both for the report. @franblanco95 do you use Session Replay?

@franblanco95
Copy link

Thank you both for the report. @franblanco95 do you use Session Replay?

Yes i do

@manuelabarca
Copy link

manuelabarca commented Aug 7, 2024

I have the same problem on Android.. The app crashes when is downloaded from the playstore. From the emulator works ok.

Same here.

ENV:
SDK version: 5.27.0
react-native version: 0.72.12

@krystofwoldrich
Copy link
Member

@LucianGalea Thank you for the report and the information, do both Hot Reload and Reload from Metro freeze the app?

@krystofwoldrich
Copy link
Member

@manuelabarca and @franblanco95 would you be able to share more information about the crash? Tombstone, stack trace...

Does in work in Release mode on real device? But crashes when downloaded from the store?

@manuelabarca
Copy link

@manuelabarca and @franblanco95 would you be able to share more information about the crash? Tombstone, stack trace...

Does in work in Release mode on real device? But crashes when downloaded from the store?

In release mode it is not working, we have tried downloading from appcenter, internal channel in google play and google play production. But in emulator it works and does not give any error messages.

Sentry capture, title: abort.
Image

@LucianGalea
Copy link
Author

LucianGalea commented Aug 7, 2024

@krystofwoldrich

@LucianGalea Thank you for the report and the information, do both Hot Reload and Reload from Metro freeze the app?

Hot reload works maybe half of the time (it's difficult to establish a pattern)
Reload from Metro always freezes the app - the only way to proceed is to kill it and restart.

@manuelabarca
Copy link

manuelabarca commented Aug 7, 2024

Env:

  • samsung a71 (Galaxy A71)
  • Android 13 (SDK 33)

I have shared the bug report via google play console to you as the library provider.
This is from google play console:

io.sentry.android.replay.ReplayCache.persistSegmentValues java.io.FileNotFoundException

Exception java.lang.RuntimeException: Could not invoke RNSentry.initNativeSdk
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:383)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:188)
  at com.facebook.jni.NativeRunnable.run
  at android.os.Handler.handleCallback (Handler.java:942)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:228)
  at java.lang.Thread.run (Thread.java:1012)
Caused by java.lang.reflect.InvocationTargetException:
  at java.lang.reflect.Method.invoke
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
Caused by java.io.FileNotFoundException:
  at libcore.io.IoBridge.open (IoBridge.java:574)
  at java.io.FileOutputStream.<init> (FileOutputStream.java:236)
  at java.io.FileOutputStream.<init> (FileOutputStream.java:186)
  at kotlin.io.FilesKt__FileReadWriteKt.writeBytes (FileReadWrite.kt:108)
  at kotlin.io.FilesKt__FileReadWriteKt.writeText (FileReadWrite.kt:134)
  at kotlin.io.FilesKt__FileReadWriteKt.writeText$default (FileReadWrite.kt:134)
  at io.sentry.android.replay.ReplayCache.persistSegmentValues (ReplayCache.kt:281)
  at io.sentry.android.replay.capture.BaseCaptureStrategy$special$$inlined$persistableAtomic$default$3$3.invoke (BaseCaptureStrategy.kt:371)
  at io.sentry.android.replay.capture.BaseCaptureStrategy$special$$inlined$persistableAtomic$default$3$3.invoke (BaseCaptureStrategy.kt:351)
  at io.sentry.android.replay.capture.BaseCaptureStrategy$special$$inlined$persistableAtomic$default$3.runInBackground (BaseCaptureStrategy.kt:338)
  at io.sentry.android.replay.capture.BaseCaptureStrategy$special$$inlined$persistableAtomic$default$3.setValue (BaseCaptureStrategy.kt:351)
  at io.sentry.android.replay.capture.BaseCaptureStrategy.setReplayType (BaseCaptureStrategy.kt:90)
  at io.sentry.android.replay.capture.BaseCaptureStrategy.start (BaseCaptureStrategy.kt:113)
  at io.sentry.android.replay.capture.SessionCaptureStrategy.start (SessionCaptureStrategy.kt:36)
  at io.sentry.android.replay.capture.CaptureStrategy$DefaultImpls.start$default (CaptureStrategy.kt:29)
  at io.sentry.android.replay.ReplayIntegration.start (ReplayIntegration.kt:156)
  at io.sentry.android.core.SentryAndroid.init (SentryAndroid.java:180)
  at io.sentry.android.core.SentryAndroid.init (SentryAndroid.java:77)
  at io.sentry.react.RNSentryModuleImpl.initNativeSdk (RNSentryModuleImpl.java:183)
  at io.sentry.react.RNSentryModule.initNativeSdk (RNSentryModule.java:43)
Caused by android.system.ErrnoException: open failed: ENOENT (No such file or directory)
  at libcore.io.Linux.open
  at libcore.io.ForwardingOs.open (ForwardingOs.java:563)
  at libcore.io.BlockGuardOs.open (BlockGuardOs.java:274)
  at libcore.io.ForwardingOs.open (ForwardingOs.java:563)
  at android.app.ActivityThread$AndroidOs.open (ActivityThread.java:8624)
  at libcore.io.IoBridge.open (IoBridge.java:560)

@krystofwoldrich krystofwoldrich changed the title Google Pixel 6 Pro issues Mobile Replay crashes on SDK init in Release mode on device Aug 9, 2024
@krystofwoldrich
Copy link
Member

@manuelabarca Thank you for the stack traces.

@romtsn It looks like the replay integration crashes during init on a file creation.

@krystofwoldrich krystofwoldrich changed the title Mobile Replay crashes on SDK init in Release mode on device Mobile Replay crashes on SDK init in Release mode on Android devices Aug 9, 2024
@mattlewer
Copy link

I'm also experiencing a crash after upgrading and implementing the session replay, for me it occurs when the user records a video and then accepts it, returning to the app.

We're using react-native-image-picker, which I believe starts its own activity. Would this be the same issue or should I open another?

@romtsn
Copy link
Member

romtsn commented Aug 12, 2024

@mattlewer what's the stacktrace of the crash?

@mattlewer
Copy link

@romtsn

TimeoutException
android.view.Surface.finalize() timed out after 60 seconds

android.view.Surface in nHwuiDestroy
android.view.Surface in access$500 at line 50
android.view.Surface$HwuiContext in destroy at line 915
android.view.Surface in release at line 236
android.view.Surface in finalize at line 218
java.lang.Daemons$FinalizerDaemon in doFinalize at line 250
java.lang.Daemons$FinalizerDaemon in runInternal at line 237
java.lang.Daemons$Daemon in run at line 103
java.lang.Thread in run at line 764

@romtsn
Copy link
Member

romtsn commented Aug 12, 2024

@mattlewer probably it's not the same issue, so I'd suggest opening a new one, and provide details like what devices does this affect, what android versions, a link to your project in sentry, etc. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Archived in project
Development

Successfully merging a pull request may close this issue.

7 participants