sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

io.sentry.android.ndk.SentryNdk.<clinit> causes ANR

Open seven415 opened this issue 1 year ago • 2 comments

Integration

sentry-android

Build System

Gradle

AGP Version

7.3.1

Proguard

Enabled

Version

7.9.0

Steps to Reproduce

sdk init

Expected Result

ANR

Actual Result

#00 pc 0x5e3e8 libc.so (syscall + 28) #01 pc 0x131bb3 libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*) + 82) #02 pc 0x2f5bed libart.so (art::JNI::NewWeakGlobalRef(_JNIEnv*, _jobject*) + 372) #03 pc 0x29d11b libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, _jobject*, _jclass*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >*) + 1930) #04 pc 0x4103 libopenjdkjvm.so (JVM_NativeLoad + 246) at java.lang.Runtime.nativeLoad(Native method) at java.lang.Runtime.nativeLoad(Runtime.java:1131) at java.lang.Runtime.loadLibrary0(Runtime.java:1085) at java.lang.Runtime.loadLibrary0(Runtime.java:1008) at java.lang.System.loadLibrary(System.java:1664) at io.sentry.android.ndk.SentryNdk.(SentryNdk.java:18) at java.lang.Class.classForName(Native method) at java.lang.Class.forName(Class.java:454) at java.lang.Class.forName(Class.java:379) at io.sentry.android.core.LoadClass.loadClass(LoadClass.java:21) at io.sentry.android.core.AndroidOptionsInitializer.installDefaultIntegrations(AndroidOptionsInitializer.java:257) at io.sentry.android.core.SentryAndroid.lambda$init$1(SentryAndroid.java:114) at io.sentry.Sentry.applyOptionsConfiguration(Sentry.java:196) at io.sentry.Sentry.init(Sentry.java:165) at io.sentry.android.core.SentryAndroid.init(SentryAndroid.java:87) at io.sentry.android.core.SentryAndroid.init(SentryAndroid.java:58) at io.sentry.android.core.SentryInitProvider.onCreate(SentryInitProvider.java) at android.content.ContentProvider.attachInfo(ContentProvider.java:2429) at android.content.ContentProvider.attachInfo(ContentProvider.java:2399) at io.sentry.android.core.SentryInitProvider.attachInfo(SentryInitProvider.java:39) at android.app.ActivityThread.installProvider(ActivityThread.java:8210) at android.app.ActivityThread.installContentProviders(ActivityThread.java:7746) at ccc.rrr.hhh.s.a.setEnd(Native method) at ccc.rrr.hhh.s.a.attachBaseContext(a.java:82) at android.app.Application.attach(Application.java:370) at android.app.Instrumentation.newApplication(Instrumentation.java:1159) at android.app.LoadedApk.makeApplication(LoadedApk.java:1324) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7543) at android.app.ActivityThread.access$1500(ActivityThread.java:301) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2177) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:246) at android.app.ActivityThread.main(ActivityThread.java:8653) at java.lang.reflect.Method.invoke(Native method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

seven415 avatar Jul 18 '24 09:07 seven415

We could by default init the native SDK off the main thread, avoiding the slow System.loadLibrary() calls on the main thread. Maybe it's worth adding a boolean flag to force-init on the main thread (to capture startup crashes as well).

markushi avatar Jul 24 '24 13:07 markushi

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

getsantry[bot] avatar Aug 15 '24 07:08 getsantry[bot]

This has been fixed with https://github.com/getsentry/sentry-java/pull/3670

markushi avatar Oct 16 '24 09:10 markushi