getsentry / sentry-java

A Sentry SDK for Java, Android and other JVM languages.
https://docs.sentry.io/
MIT License
1.15k stars 435 forks source link

ANR during Sentry Event Processing #3781

Open ZeeshanShabbir opened 1 week ago

ZeeshanShabbir commented 1 week ago

Gradle Version

8.10.2

AGP Version

8.6.1

Code Minifier/Optimizer

Dexguard

Version

4.11.0

Sentry SDK Version

7.14.0

Steps to Reproduce

We’ve received reports indicating that an ANR has been triggered, and the root cause appears to be related to the Sentry Android plugin. The ANR occurs during file access in the external storage while processing events in Sentry.

Could you please investigate this issue further?

"main" tid=1 Native

00 pc 0x00000000000ecf88 /apex/com.android.runtime/lib64/bionic/libc.so (__faccessat+8)

getsentry/sentry-android-gradle-plugin#1 pc 0x0000000000024338 /apex/com.android.art/lib64/libjavacore.so (Linux_access+76) at libcore.io.Linux.access (Native method) at libcore.io.ForwardingOs.access (ForwardingOs.java:128) at libcore.io.BlockGuardOs.access (BlockGuardOs.java:76) at libcore.io.ForwardingOs.access (ForwardingOs.java:128) at android.app.ActivityThread$AndroidOs.access (ActivityThread.java:8535) at java.io.UnixFileSystem.checkAccess (UnixFileSystem.java:332) at java.io.File.exists (File.java:829) at android.app.ContextImpl.ensureExternalDirsExistOrFilter (ContextImpl.java:3619) at android.app.ContextImpl.getExternalFilesDirs (ContextImpl.java:883) at android.app.ContextImpl.getExternalFilesDir (ContextImpl.java:872) at android.content.ContextWrapper.getExternalFilesDir (ContextWrapper.java:317) at io.sentry.android.core.DefaultAndroidEventProcessor.mergeOS (DefaultAndroidEventProcessor.java:196) at io.sentry.SentryBaseEvent.getContexts (SentryBaseEvent.java:177) at io.sentry.protocol.Contexts.toContextType (Contexts.java:97) at io.sentry.android.core.DefaultAndroidEventProcessor.mergeOS (DefaultAndroidEventProcessor.java:196) at io.sentry.protocol.Contexts.setOperatingSystem (Contexts.java:141) at io.sentry.protocol.Contexts.toContextType (Contexts.java:97) at io.sentry.android.core.DefaultAndroidEventProcessor.process (DefaultAndroidEventProcessor.java:75) at io.sentry.SentryClient.processEvent (SentryClient.java:449) at io.sentry.SentryClient.captureEvent (SentryClient.java:142) at io.sentry.Hub.captureEventInternal (Hub.java:120) at io.sentry.Hub.captureEvent (Hub.java:90) at io.sentry.Sentry.captureEvent (Sentry.java:527) at io.sentry.HubAdapter.captureEvent (HubAdapter.java:30) at io.sentry.IHub$-CC.$default$captureEvent (IHub.java:40) at io.sentry.android.timber.SentryTimberTree.captureEvent (SentryTimberTree.kt:272) at io.sentry.android.timber.SentryTimberTree.logWithSentry (SentryTimberTree.kt:240) at io.sentry.android.timber.SentryTimberTree.e (SentryTimberTree.kt:146) at timber.log.Timber$Forest.e (Timber.kt:342)

Expected Result

Sentry should work without creating the ANR

Actual Result

Sentry is causing the ANR and impacting the app's performance

markushi commented 6 days ago

The Sentry Android Plugin is a Gradle Build Plugin, I hope you're not shipping that within your app 😅 In any case this sounds like something we should have a look at, thanks for reporting!