Skip to content

Crash in DatadogExceptionHandler.uncaughtException #749

Description

@ribafish

Describe what happened
We've updated the datadog SDK from 1.8.1 to 1.10.0 and started getting reports in crashlytics about a crash in com.datadog.android.error.internal.DatadogExceptionHandler.uncaughtException (DatadogExceptionHandler.kt:48).

Stacktrace is:

Fatal Exception: java.lang.InterruptedException
       at java.lang.Thread.sleep(Thread.java)
       at java.lang.Thread.sleep(Thread.java:442)
       at java.lang.Thread.sleep(Thread.java:358)
       at com.datadog.android.core.internal.thread.ThreadPoolExecutorExtKt.waitToIdle(ThreadPoolExecutorExt.kt:22)
       at com.datadog.android.error.internal.DatadogExceptionHandler.uncaughtException(DatadogExceptionHandler.kt:48)
       at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1073)
       at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
       at com.example.App.setupRxErrorHandler$lambda-1(App.kt:127)
       at com.example.App.$r8$lambda$6udbihR2S1y1Ewy0Tyb_4i9aGG8()
       at com.example.App$$ExternalSyntheticLambda0.accept(:2)
       at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:373)
       at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:50)
       at io.reactivex.Single.subscribe(Single.java:3666)
       at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
       at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
       at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

and the com.example.App.setupRxErrorHandler$lambda-1(App.kt:127) code is:

        RxJavaPlugins.setErrorHandler { e ->
// ****** Checking for different types of exceptions and handling them accordingly, before getting to the part that's in the stacktrace above ******
            if (e is IllegalStateException) {
                // that's a bug in RxJava or in a custom operator
                Thread.currentThread().uncaughtExceptionHandler
                        .uncaughtException(Thread.currentThread(), e)   // ***** this is line 127 *****
                return@setErrorHandler
            }

Steps to reproduce the issue:
Not sure yet, still working on reproducing it.

Describe what you expected:
Not to crash because of this.

Additional context

  • Android OS version: 8 to 12
  • Device Model: at the moment, 21 different devices from different vendors (samsung, xiaomi, google, motorola, huawei, lg, onePlus,...)
  • Datadog SDK version: 1.10.0
  • Versions of any other relevant dependencies (OkHttp, …): okhttp 4.9.2, retrofit 2.9.0, rxjava2:rxandroid:2.1.1, rxjava2:rxkotlin:2.4.0, kotlin 1.5.31
  • Proguard configuration: none
  • Gradle Plugins: agp 7.0.2,

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions