getsentry / sentry-java

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

io.sentry.JsonSerializer.<init> ANR triggered by slow operations in main thread #3583

Closed seven415 closed 3 months ago

seven415 commented 3 months ago

Description

com.android.tools.build:gradle:7.3.1

SDK Version:7.9.0

log from firebase:

java.lang.Object.hashCode (Object.java:122) java.util.HashMap.hash (HashMap.java:336) java.util.HashMap.put (HashMap.java:608) io.sentry.JsonSerializer. (JsonSerializer.java:113) io.sentry.SentryOptions. (SentryOptions.java:122) io.sentry.SentryOptions.empty (SentryOptions.java:2495) io.sentry.NoOpHub. (NoOpHub.java:22) io.sentry.NoOpHub. (NoOpHub.java:16) io.sentry.Sentry. (Sentry.java:47) io.sentry.android.core.SentryAndroid.init (SentryAndroid.java:87) io.sentry.android.core.SentryAndroid.init (SentryAndroid.java:58) io.sentry.android.core.SentryInitProvider.onCreate (SentryInitProvider.java) android.content.ContentProvider.attachInfo (ContentProvider.java:2468) android.content.ContentProvider.attachInfo (ContentProvider.java:2433) io.sentry.android.core.SentryInitProvider.attachInfo (SentryInitProvider.java:39) android.app.ActivityThread.installProvider (ActivityThread.java:7867) android.app.ActivityThread.installContentProviders (ActivityThread.java:7378) ccc.rrr.hhh.s.a.setEnd (Native method) ccc.rrr.hhh.s.a.attachBaseContext (a.java:82) android.app.Application.attach (Application.java:355) android.app.Instrumentation.newApplication (Instrumentation.java:1251) android.app.LoadedApk.makeApplicationInner (LoadedApk.java:1485) android.app.LoadedApk.makeApplicationInner (LoadedApk.java:1422) android.app.ActivityThread.handleBindApplication (ActivityThread.java:7087) android.app.ActivityThread.-$$Nest$mhandleBindApplication (unavailable) android.app.ActivityThread$H.handleMessage (ActivityThread.java:2220) android.os.Handler.dispatchMessage (Handler.java:106) android.os.Looper.loopOnce (Looper.java:211) android.os.Looper.loop (Looper.java:300) android.app.ActivityThread.main (ActivityThread.java:8296) java.lang.reflect.Method.invoke (Native method) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:559) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:954)

kahest commented 3 months ago

Hi @seven415 can you share your Sentry options? Can you reproduce this locally with a minimal setup? And do you also see other ANR events on startup/initialization of your app? If something blocks the main thread extensively, the stack traces of reported ANRs might not be reliable.

related: https://github.com/getsentry/sentry-java/issues/3584 https://github.com/getsentry/sentry-java/issues/3585 might have the same root cause, all happening during initialization

seven415 commented 3 months ago

It cannot be reproduced locally. These ANRs are all seen from firebase. 7 days data:

Image

kahest commented 3 months ago

@seven415 can you share your Sentry options? Do you also see other ANR events on startup/initialization of your app? If something blocks the main thread extensively, the stack traces of reported ANRs might not be reliable.

seven415 commented 3 months ago

@kahest

Image

markushi commented 3 months ago

@seven415 thanks for reporting this issue. We're closing this in favor of https://github.com/getsentry/sentry-java/issues/2541, which is a similar issue.