DataDog / dd-sdk-android

Datadog SDK for Android (Compatible with Kotlin and Java)
Apache License 2.0
159 stars 61 forks source link

Crash insights point to dd-sdk-android-okhttp #2208

Closed ntsparis closed 3 months ago

ntsparis commented 3 months ago

Stack trace

Exception io.reactivex.exceptions.OnErrorNotImplementedException: at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept (Functions.java:704) at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept (Functions.java:701) at io.reactivex.internal.observers.LambdaObserver.onError (LambdaObserver.java:77) at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onError (ObservableSubscribeOn.java:63) at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onError (ObservableSubscribeOn.java:63) at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onError (BodyObservable.java:72) at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual (CallExecuteObservable.java:59) at io.reactivex.Observable.subscribe (Observable.java:12284) at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual (BodyObservable.java:34) at io.reactivex.Observable.subscribe (Observable.java:12284) at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run (ObservableSubscribeOn.java:96) at io.reactivex.Scheduler$DisposeTask.run (Scheduler.java:578) at io.reactivex.internal.schedulers.ScheduledRunnable.run (ScheduledRunnable.java:66) at io.reactivex.internal.schedulers.ScheduledRunnable.call (ScheduledRunnable.java:57) at java.util.concurrent.FutureTask.run (FutureTask.java:264) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:307) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:644) at java.lang.Thread.run (Thread.java:1012) Caused by java.net.UnknownHostException: at java.net.Inet6AddressImpl.lookupHostByName (Inet6AddressImpl.java:156) at java.net.Inet6AddressImpl.lookupAllHostAddr (Inet6AddressImpl.java:103) at java.net.InetAddress.getAllByName (InetAddress.java:1152) at okhttp3.Dns$Companion$DnsSystem.lookup (Dns.kt:49) at okhttp3.internal.connection.RouteSelector.resetNextInetSocketAddress (RouteSelector.kt:169) at okhttp3.internal.connection.RouteSelector.nextProxy (RouteSelector.kt:131) at okhttp3.internal.connection.RouteSelector.next (RouteSelector.kt:73) at okhttp3.internal.connection.ExchangeFinder.findConnection (ExchangeFinder.kt:205) at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection (ExchangeFinder.kt:106) at okhttp3.internal.connection.ExchangeFinder.find (ExchangeFinder.kt:74) at okhttp3.internal.connection.RealCall.initExchange$okhttp (RealCall.kt:255) at okhttp3.internal.connection.ConnectInterceptor.intercept (ConnectInterceptor.kt:32) at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109) at okhttp3.internal.cache.CacheInterceptor.intercept (CacheInterceptor.kt:95) at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109) at okhttp3.internal.http.BridgeInterceptor.intercept (BridgeInterceptor.kt:83) at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept (RetryAndFollowUpInterceptor.kt:76) at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109) at okhttp3.logging.HttpLoggingInterceptor.intercept (HttpLoggingInterceptor.kt:154) at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109) at **.intercept (Interceptor.kt:17) at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109) at com.datadog.android.okhttp.trace.TracingInterceptor.intercept (TracingInterceptor.kt:321) at com.datadog.android.okhttp.trace.TracingInterceptor.intercept (TracingInterceptor.kt:219) at com.datadog.android.okhttp.DatadogInterceptor.intercept (DatadogInterceptor.kt:237) at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109) at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp (RealCall.kt:201) at okhttp3.internal.connection.RealCall.execute (RealCall.kt:154) at retrofit2.OkHttpCall.execute (OkHttpCall.java:204) at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual (CallExecuteObservable.java:45) Caused by android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname) at libcore.io.Linux.android_getaddrinfo at libcore.io.ForwardingOs.android_getaddrinfo (ForwardingOs.java:133) at libcore.io.BlockGuardOs.android_getaddrinfo (BlockGuardOs.java:222) at libcore.io.ForwardingOs.android_getaddrinfo (ForwardingOs.java:133) at java.net.Inet6AddressImpl.lookupHostByName (Inet6AddressImpl.java:135)

Reproduction steps

We keep getting a lot of crashes (>30) in our production app and the Insights provide the following feedback: This crash is possibly related to an SDK To help resolve this crash, share it with dd-sdk-android-okhttp We cannot reproduce it locally. However, from the breadcrumbs we see that it crashes upon starting the app. Crash se

Volume

5-10

Affected SDK versions

We use 2.10.1 for dd-sdk-android-rum and for dd-sdk-android-okhttp and 1.14.0 for dd-sdk-android-gradle-plugin

Latest working SDK version

-

Does the crash manifest in the latest SDK version?

Yes

Kotlin / Java version

2.0.0

Gradle / AGP version

8.3.2

Other dependencies versions

We use 4.9.3 for com.squareup.okhttp3:okhttp and for com.squareup.okhttp3:logging-interceptor as well as 2.2.3 for io.reactivex.rxjava2:rxjava

Device Information

image

Other relevant information

0xnm commented 3 months ago

Hello @ntsparis!

It seems this issue is not Datadog SDK fault (Datadog SDK is in the exception stacktrace just because of the interceptor installed), but rather you should implement error handling in your Rx chain. For more information you may want to check the following links:

ntsparis commented 2 months ago

@0xnm i am not sure since we have implemented error handling all over the application and there is no crash until datadog sdk implementation. We use just (Deprecated) interceptor DatadogInterceptor() is this could be a problem?

0xnm commented 2 months ago

@ntsparis You have io.reactivex.exceptions.OnErrorNotImplementedException meaning some stream is missing the case for this error.

Using a deprecated constructor is not a problem.

ntsparis commented 2 months ago

It's true that this error seems related to an unhandled case, but in our project, we already use a base error-handling mechanism, so this issue should have appeared even before integrating the Datadog SDK. It's strange that the crash was triggered only after the SDK's installation and not before?

Additionally, I'd like to share another stack trace to highlight that the issue arises specifically due to the error, not the implementation structure. It's important to note that this error didn't exist prior to integrating Datadog, and both Crashlytics and Google Console are providing insights pointing directly to the specific SDK. We have also share crash from Google play console.

Caused by javax.net.ssl.SSLPeerUnverifiedException: at okhttp3.internal.connection.RealConnection.connectTls (RealConnection.kt:389) at okhttp3.internal.connection.RealConnection.establishProtocol (RealConnection.kt:337) at okhttp3.internal.connection.RealConnection.connect (RealConnection.kt:209) at okhttp3.internal.connection.ExchangeFinder.findConnection (ExchangeFinder.kt:226) at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection (ExchangeFinder.kt:106) at okhttp3.internal.connection.ExchangeFinder.find (ExchangeFinder.kt:74) at okhttp3.internal.connection.RealCall.initExchange$okhttp (RealCall.kt:255) at okhttp3.internal.connection.ConnectInterceptor.intercept (ConnectInterceptor.kt:32) at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109) at okhttp3.internal.cache.CacheInterceptor.intercept (CacheInterceptor.kt:95) at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109) at okhttp3.internal.http.BridgeInterceptor.intercept (BridgeInterceptor.kt:83) at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept (RetryAndFollowUpInterceptor.kt:76) at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109) at okhttp3.logging.HttpLoggingInterceptor.intercept (HttpLoggingInterceptor.kt:154) at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109) at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109) at com.datadog.android.okhttp.trace.TracingInterceptor.intercept (TracingInterceptor.kt:349) at com.datadog.android.okhttp.trace.TracingInterceptor.intercept (TracingInterceptor.kt:247) at com.datadog.android.okhttp.DatadogInterceptor.intercept (DatadogInterceptor.kt:263) at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109) at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109) at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp (RealCall.kt:201) at okhttp3.internal.connection.RealCall.execute (RealCall.kt:154) at retrofit2.OkHttpCall.execute (OkHttpCall.java:204) at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual (CallExecuteObservable.java:45)