Skip to content

ANR when initialising Sentry SDK  #3040

@Angelodaniel

Description

@Angelodaniel

Integration

sentry-android

Build System

Gradle

AGP Version

7.2.1

Proguard

Enabled

Version

6.28.0

Steps to Reproduce

Android config:
SentryAndroid.init(this) { options ->
options.dsn = Env.sentryDsn
options.environment = Env.sentryEnvironment
options.dist = Env.sentryEnvironment
options.tracesSampleRate = traceRate
options.sampleRate = errorRate
options.isEnableAutoActivityLifecycleTracing = false
options.isEnableActivityLifecycleBreadcrumbs = false
options.isEnableAppLifecycleBreadcrumbs = false
}

Expected Result

ANRs not to occur based on that config

Actual Result

it looks like calling system service which calls into a native methods upon creation, perhaps we could offload those integrations to a background thread

Logs:
main (runnable):tid=1 systid=10039 #00 pc 0x4a6c6c libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool) + 140) #01 pc 0x5b5674 libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool, BacktraceMap*, bool) const + 372) #02 pc 0x5d305c libart.so (art::DumpCheckpoint::Run(art::Thread*) + 924) #03 pc 0x5b65e0 libart.so (art::Thread::RunCheckpointFunction() + 176) #04 pc 0x674510 libart.so (art::JniMethodFastEndWithReference(_jobject*, unsigned int, art::Thread*) + 112) at java.lang.String.intern(Native method) at android.hardware.SystemSensorManager.nativeGetSensorAtIndex(Native method) at android.hardware.SystemSensorManager.<init>(SystemSensorManager.java:121) at android.app.SystemServiceRegistry$41.createService(SystemServiceRegistry.java:683) at android.app.SystemServiceRegistry$41.createService(SystemServiceRegistry.java:679) at android.app.SystemServiceRegistry$CachedServiceFetcher.getService(SystemServiceRegistry.java:1912) at android.app.SystemServiceRegistry.getSystemService(SystemServiceRegistry.java:1590) at android.app.ContextImpl.getSystemService(ContextImpl.java:1976) at android.content.ContextWrapper.getSystemService(ContextWrapper.java:813) at io.sentry.android.core.TempSensorBreadcrumbsIntegration.register(TempSensorBreadcrumbsIntegration.java:55) at io.sentry.Sentry.init(Sentry.java:237) at io.sentry.Sentry.init(Sentry.java:147) at io.sentry.android.core.SentryAndroid.init(SentryAndroid.java:89) at io.sentry.android.core.SentryAndroid.init(SentryAndroid.java:70) at com.*.BaseApplication.initializeSentry(BaseApplication.kt:137) at com.*.BaseApplication.onCreate(BaseApplication.kt:114) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7294) at android.app.ActivityThread.access$1700(ActivityThread.java:299) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2184) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:264) at android.app.ActivityThread.main(ActivityThread.java:8312) at java.lang.reflect.Method.invoke(Native method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:632) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)

┆Issue is synchronized with this Jira Improvement by Unito

Metadata

Metadata

Assignees

Labels

BugIssue type

Projects

Status

Done

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions