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

Sentry.init() causes ANR #2941

Closed
kylannjohnson opened this issue Sep 19, 2023 · 3 comments
Closed

Sentry.init() causes ANR #2941

kylannjohnson opened this issue Sep 19, 2023 · 3 comments

Comments

@kylannjohnson
Copy link

Integration

sentry-android

Build System

Gradle

AGP Version

8.1.0

Proguard

Enabled

Version

6.26.0

Steps to Reproduce

Call Sentry.init() in the onCreate method of the Application class, per the docs

Expected Result

For construction of a No-op, you would expect no hit to performance and thus no chance of ANR.

Actual Result

I replaced our app-specifc paths in the ANR stack trace below. It looks like the ANR is happening on construction of the NoOp Hub

io.sentry.android.core.ApplicationNotResponding: Background ANR
    at io.sentry.JsonSerializer.<init>(unavailable:0)
    at io.sentry.JsonSerializer.<init>(unavailable:71)
    at io.sentry.SentryOptions.<init>(SourceFile:116)
    at io.sentry.SentryOptions.empty(unavailable:0)
    at io.sentry.NoOpHub.<init>(unavailable:0)
    at io.sentry.NoOpHub.<init>(unavailable:14)
    at io.sentry.NoOpHub.<clinit>(unavailable:0)
    at io.sentry.NoOpHub.getInstance(unavailable:0)
    at io.sentry.Sentry.<clinit>(unavailable:0)
    at io.sentry.Sentry.<clinit>(unavailable:40)
    at io.sentry.Sentry.init(unavailable:0)
    at io.sentry.android.core.SentryAndroid.init(unavailable:89)
    at io.sentry.android.core.SentryAndroid.init(unavailable:0)
    at app.foo.crashreporter.sentry.SentryModule$sentryThirdPartyInitialization$1.initialize(unavailable:0)
    at app.foo.crashreporter.sentry.SentryModule$sentryThirdPartyInitialization$1.initialize(unavailable:55)
    at app.foo.init.DomainThirdPartyInitializer.initialize(unavailable:0)
    at app.foo.init.DomainThirdPartyInitializer.initialize(unavailable:51)
    at app.foo.FooApplication.onCreate(unavailable:282)
    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1266)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6785)
    at android.app.ActivityThread.-$$Nest$mhandleBindApplication(unavailable:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2134)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7898)
    at java.lang.reflect.Method.invoke
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
@romtsn
Copy link
Member

romtsn commented Sep 21, 2023

Hi @kylannjohnson thanks for reporting. I assume you have disabled auto-init following the docs instructions, right?

<application>
    <meta-data android:name="io.sentry.auto-init" android:value="false" />
</application>

I also, think this is probably a dupe of #2541, let me know if it isn't. Otherwise I'd track it there

@markushi markushi moved this from Needs Discussion to Needs More Information in Mobile & Cross Platform SDK Sep 21, 2023
@kylannjohnson
Copy link
Author

Hi @kylannjohnson thanks for reporting. I assume you have disabled auto-init following the docs instructions, right?

<application>
    <meta-data android:name="io.sentry.auto-init" android:value="false" />
</application>

I also, think this is probably a dupe of #2541, let me know if it isn't. Otherwise I'd track it there

Hey @romtsn . Yes on both counts: we turn off auto init and I think that the issue is the eager initialization. Thanks for pointing me to the existing issue.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Sep 21, 2023
@romtsn
Copy link
Member

romtsn commented Sep 21, 2023

Hi @kylannjohnson thanks for reporting. I assume you have disabled auto-init following the docs instructions, right?

<application>
    <meta-data android:name="io.sentry.auto-init" android:value="false" />
</application>

I also, think this is probably a dupe of #2541, let me know if it isn't. Otherwise I'd track it there

Hey @romtsn . Yes on both counts: we turn off auto init and I think that the issue is the eager initialization. Thanks for pointing me to the existing issue.

alright, i'm gonna close this one then, let's track it there. We'll try to find resources and fix that shortly. thanks!

@romtsn romtsn closed this as not planned Won't fix, can't repro, duplicate, stale Sep 21, 2023
@github-project-automation github-project-automation bot moved this from Needs More Information to Done in Mobile & Cross Platform SDK Sep 21, 2023
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

No branches or pull requests

2 participants