question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash when trying to connect too fast [UndeliverableException]

See original GitHub issue

lib version 1.5 rx2 I am facing issue in my app and in the sample app but i cannot find where the issue source is.

To reproduce, it’s really easy, you have to try a connection just right after reactivate Bluetooth on the device (about 1 sec after). I think the GATT stack is not really ready but in fact it throw a disconnection although the connection process is not done. it’s seems that a exception is not handle and rx is not happy but i am not sure.

logs :

03-08 14:47:18.292 11563-11677/com.polidea.rxandroidble.sample I/RxBle#ConnectionOperationQueue: Connection operations queue to be terminated (AA:BB:CC:11:22:33)
03-08 14:47:18.295 11563-11676/com.polidea.rxandroidble.sample D/RxBle#Executors$RunnableAdapter: Terminated.
03-08 14:47:18.297 11563-11677/com.polidea.rxandroidble.sample D/RxBle#ClientOperationQueue: QUEUED   ConnectOperation(154038096)
03-08 14:47:18.298 11563-11580/com.polidea.rxandroidble.sample D/RxBle#ClientOperationQueue: STARTED  ConnectOperation(154038096)
03-08 14:47:18.302 11563-11677/com.polidea.rxandroidble.sample D/RxBle#ClientOperationQueue: QUEUED   DisconnectOperation(110097737)
03-08 14:47:18.303 11563-11586/com.polidea.rxandroidble.sample W/System.err: io.reactivex.exceptions.UndeliverableException: com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from AA:BB:CC:11:22:33
03-08 14:47:18.304 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:366)
03-08 14:47:18.304 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableUnsubscribeOn$UnsubscribeObserver.onError(ObservableUnsubscribeOn.java:67)
03-08 14:47:18.304 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onError(ObservableSubscribeOn.java:63)
03-08 14:47:18.304 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableCreate$CreateEmitter.tryOnError(ObservableCreate.java:85)
03-08 14:47:18.304 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableCreate$CreateEmitter.onError(ObservableCreate.java:73)
03-08 14:47:18.304 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.internal.util.DisposableUtil$3.onError(DisposableUtil.java:60)
03-08 14:47:18.304 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.single.SingleDoFinally$DoFinallyObserver.onError(SingleDoFinally.java:81)
03-08 14:47:18.304 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.single.SingleTimeout$TimeoutMainObserver.onError(SingleTimeout.java:142)
03-08 14:47:18.304 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.single.SingleCreate$Emitter.tryOnError(SingleCreate.java:95)
03-08 14:47:18.304 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.single.SingleCreate$Emitter.onError(SingleCreate.java:81)
03-08 14:47:18.304 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.internal.util.DisposableUtil$1.onError(DisposableUtil.java:24)
03-08 14:47:18.305 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.flowable.FlowableElementAtSingle$ElementAtSubscriber.onError(FlowableElementAtSingle.java:101)
03-08 14:47:18.305 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.checkTerminate(FlowableFlatMap.java:566)
03-08 14:47:18.305 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.drainLoop(FlowableFlatMap.java:374)
03-08 14:47:18.305 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.drain(FlowableFlatMap.java:366)
03-08 14:47:18.305 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.innerError(FlowableFlatMap.java:605)
03-08 14:47:18.305 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.flowable.FlowableFlatMap$InnerSubscriber.onError(FlowableFlatMap.java:668)
03-08 14:47:18.306 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.single.SingleToFlowable$SingleToFlowableObserver.onError(SingleToFlowable.java:68)
03-08 14:47:18.306 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableElementAtSingle$ElementAtObserver.onError(ObservableElementAtSingle.java:104)
03-08 14:47:18.306 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.checkTerminate(ObservableFlatMap.java:495)
03-08 14:47:18.306 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drainLoop(ObservableFlatMap.java:331)
03-08 14:47:18.306 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drain(ObservableFlatMap.java:323)
03-08 14:47:18.306 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableFlatMap$InnerObserver.onError(ObservableFlatMap.java:571)
03-08 14:47:18.306 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.disposables.EmptyDisposable.error(EmptyDisposable.java:63)
03-08 14:47:18.306 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableError.subscribeActual(ObservableError.java:37)
03-08 14:47:18.306 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.307 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:162)
03-08 14:47:18.307 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
03-08 14:47:18.307 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.util.NotificationLite.accept(NotificationLite.java:246)
03-08 14:47:18.307 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableCache$ReplayDisposable.replay(ObservableCache.java:350)
03-08 14:47:18.307 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableCache.subscribeActual(ObservableCache.java:85)
03-08 14:47:18.307 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.307 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableFlatMap.subscribeActual(ObservableFlatMap.java:55)
03-08 14:47:18.307 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.307 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableElementAtSingle.subscribeActual(ObservableElementAtSingle.java:37)
03-08 14:47:18.307 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Single.subscribe(Single.java:3096)
03-08 14:47:18.307 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.single.SingleToFlowable.subscribeActual(SingleToFlowable.java:37)
03-08 14:47:18.308 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Flowable.subscribe(Flowable.java:13234)
03-08 14:47:18.308 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Flowable.subscribe(Flowable.java:13180)
03-08 14:47:18.308 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.onNext(FlowableFlatMap.java:163)
03-08 14:47:18.308 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.flowable.FlowableFromArray$ArraySubscription.fastPath(FlowableFromArray.java:134)
03-08 14:47:18.308 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.flowable.FlowableFromArray$BaseArraySubscription.request(FlowableFromArray.java:87)
03-08 14:47:18.308 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.onSubscribe(FlowableFlatMap.java:115)
03-08 14:47:18.308 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.flowable.FlowableFromArray.subscribeActual(FlowableFromArray.java:37)
03-08 14:47:18.308 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Flowable.subscribe(Flowable.java:13234)
03-08 14:47:18.308 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Flowable.subscribe(Flowable.java:13180)
03-08 14:47:18.308 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.flowable.FlowableFlatMapPublisher.subscribeActual(FlowableFlatMapPublisher.java:43)
03-08 14:47:18.308 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Flowable.subscribe(Flowable.java:13234)
03-08 14:47:18.309 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.flowable.FlowableElementAtSingle.subscribeActual(FlowableElementAtSingle.java:41)
03-08 14:47:18.309 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Single.subscribe(Single.java:3096)
03-08 14:47:18.309 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Single.subscribeWith(Single.java:3140)
03-08 14:47:18.309 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.internal.operations.ConnectOperation$4.subscribe(ConnectOperation.java:144)
03-08 14:47:18.309 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.single.SingleCreate.subscribeActual(SingleCreate.java:39)
03-08 14:47:18.309 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Single.subscribe(Single.java:3096)
03-08 14:47:18.310 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.single.SingleTimeout.subscribeActual(SingleTimeout.java:53)
03-08 14:47:18.310 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Single.subscribe(Single.java:3096)
03-08 14:47:18.310 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.single.SingleDoFinally.subscribeActual(SingleDoFinally.java:46)
03-08 14:47:18.310 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Single.subscribe(Single.java:3096)
03-08 14:47:18.311 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Single.subscribeWith(Single.java:3140)
03-08 14:47:18.313 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.internal.operations.ConnectOperation.protectedRun(ConnectOperation.java:79)
03-08 14:47:18.313 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.internal.QueueOperation$1.subscribe(QueueOperation.java:41)
03-08 14:47:18.313 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableCreate.subscribeActual(ObservableCreate.java:40)
03-08 14:47:18.313 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.314 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
03-08 14:47:18.314 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
03-08 14:47:18.314 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
03-08 14:47:18.314 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
03-08 14:47:18.314 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
03-08 14:47:18.314 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
03-08 14:47:18.314 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at java.lang.Thread.run(Thread.java:761)
03-08 14:47:18.315 11563-11586/com.polidea.rxandroidble.sample W/System.err: Caused by: com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from AA:BB:CC:11:22:33
03-08 14:47:18.315 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.internal.connection.DisconnectionRouter$1.apply(DisconnectionRouter.java:38)
03-08 14:47:18.315 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.internal.connection.DisconnectionRouter$1.apply(DisconnectionRouter.java:35)
03-08 14:47:18.315 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:59)
03-08 14:47:18.315 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableFilter$FilterObserver.onNext(ObservableFilter.java:52)
03-08 14:47:18.316 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableConcatMap$ConcatMapDelayErrorObserver.drain(ObservableConcatMap.java:464)
03-08 14:47:18.316 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableConcatMap$ConcatMapDelayErrorObserver.onSubscribe(ObservableConcatMap.java:324)
03-08 14:47:18.316 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableFromArray.subscribeActual(ObservableFromArray.java:30)
03-08 14:47:18.316 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.316 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableConcatMap.subscribeActual(ObservableConcatMap.java:54)
03-08 14:47:18.316 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.316 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableFilter.subscribeActual(ObservableFilter.java:30)
03-08 14:47:18.316 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.316 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:33)
03-08 14:47:18.316 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.316 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:162)
03-08 14:47:18.316 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
03-08 14:47:18.317 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableFromArray$FromArrayDisposable.run(ObservableFromArray.java:107)
03-08 14:47:18.317 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableFromArray.subscribeActual(ObservableFromArray.java:36)
03-08 14:47:18.317 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.317 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableFlatMap.subscribeActual(ObservableFlatMap.java:55)
03-08 14:47:18.317 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.317 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableElementAt.subscribeActual(ObservableElementAt.java:36)
03-08 14:47:18.317 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.317 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableCache$CacheState.connect(ObservableCache.java:216)
03-08 14:47:18.317 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableCache.subscribeActual(ObservableCache.java:82)
03-08 14:47:18.317 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.317 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11180)
03-08 14:47:18.317 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11058)
03-08 14:47:18.318 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.internal.connection.DisconnectionRouter.<init>(DisconnectionRouter.java:60)
03-08 14:47:18.318 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.internal.connection.DisconnectionRouter_Factory.get(DisconnectionRouter_Factory.java:33)
03-08 14:47:18.318 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.internal.connection.DisconnectionRouter_Factory.get(DisconnectionRouter_Factory.java:10)
03-08 14:47:18.318 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at bleshadow.dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
03-08 14:47:18.318 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.internal.connection.RxBleGattCallback_Factory.get(RxBleGattCallback_Factory.java:33)
03-08 14:47:18.318 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.internal.connection.RxBleGattCallback_Factory.get(RxBleGattCallback_Factory.java:8)
03-08 14:47:18.318 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at bleshadow.dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
03-08 14:47:18.318 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.DaggerClientComponent$DeviceComponentImpl$ConnectionComponentImpl.connectOperation(DaggerClientComponent.java:713)
03-08 14:47:18.318 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.internal.connection.ConnectorImpl$1.call(ConnectorImpl.java:56)
03-08 14:47:18.318 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.internal.connection.ConnectorImpl$1.call(ConnectorImpl.java:41)
03-08 14:47:18.318 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableDefer.subscribeActual(ObservableDefer.java:32)
03-08 14:47:18.318 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.319 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableDoFinally.subscribeActual(ObservableDoFinally.java:45)
03-08 14:47:18.319 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.319 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableDefer.subscribeActual(ObservableDefer.java:39)
03-08 14:47:18.319 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.319 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableTakeUntil.subscribeActual(ObservableTakeUntil.java:41)
03-08 14:47:18.319 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.319 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableObserveOn.subscribeActual(ObservableObserveOn.java:45)
03-08 14:47:18.319 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.319 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.internal.operators.observable.ObservableDoFinally.subscribeActual(ObservableDoFinally.java:45)
03-08 14:47:18.319 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.319 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11180)
03-08 14:47:18.319 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at io.reactivex.Observable.subscribe(Observable.java:11109)
03-08 14:47:18.320 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.sample.example2_connection.ConnectionExampleActivity.onConnectToggleClick(ConnectionExampleActivity.java:52)
03-08 14:47:18.320 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.polidea.rxandroidble2.sample.example2_connection.ConnectionExampleActivity_ViewBinding$1.doClick(ConnectionExampleActivity_ViewBinding.java:43)
03-08 14:47:18.320 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22)
03-08 14:47:18.320 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at android.view.View.performClick(View.java:5637)
03-08 14:47:18.320 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at android.view.View$PerformClick.run(View.java:22429)
03-08 14:47:18.320 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at android.os.Handler.handleCallback(Handler.java:751)
03-08 14:47:18.320 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
03-08 14:47:18.320 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at android.os.Looper.loop(Looper.java:154)
03-08 14:47:18.320 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6119)
03-08 14:47:18.320 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
03-08 14:47:18.320 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
03-08 14:47:18.320 11563-11586/com.polidea.rxandroidble.sample W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
03-08 14:47:18.322 11563-11586/com.polidea.rxandroidble.sample E/AndroidRuntime: FATAL EXCEPTION: pool-1-thread-1
                                                                                 Process: com.polidea.rxandroidble.sample, PID: 11563
                                                                                 io.reactivex.exceptions.UndeliverableException: com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from AA:BB:CC:11:22:33
                                                                                     at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:366)
                                                                                     at io.reactivex.internal.operators.observable.ObservableUnsubscribeOn$UnsubscribeObserver.onError(ObservableUnsubscribeOn.java:67)
                                                                                     at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onError(ObservableSubscribeOn.java:63)
                                                                                     at io.reactivex.internal.operators.observable.ObservableCreate$CreateEmitter.tryOnError(ObservableCreate.java:85)
                                                                                     at io.reactivex.internal.operators.observable.ObservableCreate$CreateEmitter.onError(ObservableCreate.java:73)
                                                                                     at com.polidea.rxandroidble2.internal.util.DisposableUtil$3.onError(DisposableUtil.java:60)
                                                                                     at io.reactivex.internal.operators.single.SingleDoFinally$DoFinallyObserver.onError(SingleDoFinally.java:81)
                                                                                     at io.reactivex.internal.operators.single.SingleTimeout$TimeoutMainObserver.onError(SingleTimeout.java:142)
                                                                                     at io.reactivex.internal.operators.single.SingleCreate$Emitter.tryOnError(SingleCreate.java:95)
                                                                                     at io.reactivex.internal.operators.single.SingleCreate$Emitter.onError(SingleCreate.java:81)
                                                                                     at com.polidea.rxandroidble2.internal.util.DisposableUtil$1.onError(DisposableUtil.java:24)
                                                                                     at io.reactivex.internal.operators.flowable.FlowableElementAtSingle$ElementAtSubscriber.onError(FlowableElementAtSingle.java:101)
                                                                                     at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.checkTerminate(FlowableFlatMap.java:566)
                                                                                     at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.drainLoop(FlowableFlatMap.java:374)
                                                                                     at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.drain(FlowableFlatMap.java:366)
                                                                                     at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.innerError(FlowableFlatMap.java:605)
                                                                                     at io.reactivex.internal.operators.flowable.FlowableFlatMap$InnerSubscriber.onError(FlowableFlatMap.java:668)
                                                                                     at io.reactivex.internal.operators.single.SingleToFlowable$SingleToFlowableObserver.onError(SingleToFlowable.java:68)
                                                                                     at io.reactivex.internal.operators.observable.ObservableElementAtSingle$ElementAtObserver.onError(ObservableElementAtSingle.java:104)
                                                                                     at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.checkTerminate(ObservableFlatMap.java:495)
                                                                                     at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drainLoop(ObservableFlatMap.java:331)
                                                                                     at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drain(ObservableFlatMap.java:323)
                                                                                     at io.reactivex.internal.operators.observable.ObservableFlatMap$InnerObserver.onError(ObservableFlatMap.java:571)
                                                                                     at io.reactivex.internal.disposables.EmptyDisposable.error(EmptyDisposable.java:63)
                                                                                     at io.reactivex.internal.operators.observable.ObservableError.subscribeActual(ObservableError.java:37)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:162)
                                                                                     at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
                                                                                     at io.reactivex.internal.util.NotificationLite.accept(NotificationLite.java:246)
                                                                                     at io.reactivex.internal.operators.observable.ObservableCache$ReplayDisposable.replay(ObservableCache.java:350)
                                                                                     at io.reactivex.internal.operators.observable.ObservableCache.subscribeActual(ObservableCache.java:85)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.internal.operators.observable.ObservableFlatMap.subscribeActual(ObservableFlatMap.java:55)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.internal.operators.observable.ObservableElementAtSingle.subscribeActual(ObservableElementAtSingle.java:37)
                                                                                     at io.reactivex.Single.subscribe(Single.java:3096)
03-08 14:47:18.324 11563-11586/com.polidea.rxandroidble.sample E/AndroidRuntime:     at io.reactivex.internal.operators.single.SingleToFlowable.subscribeActual(SingleToFlowable.java:37)
                                                                                     at io.reactivex.Flowable.subscribe(Flowable.java:13234)
                                                                                     at io.reactivex.Flowable.subscribe(Flowable.java:13180)
                                                                                     at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.onNext(FlowableFlatMap.java:163)
                                                                                     at io.reactivex.internal.operators.flowable.FlowableFromArray$ArraySubscription.fastPath(FlowableFromArray.java:134)
                                                                                     at io.reactivex.internal.operators.flowable.FlowableFromArray$BaseArraySubscription.request(FlowableFromArray.java:87)
                                                                                     at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.onSubscribe(FlowableFlatMap.java:115)
                                                                                     at io.reactivex.internal.operators.flowable.FlowableFromArray.subscribeActual(FlowableFromArray.java:37)
                                                                                     at io.reactivex.Flowable.subscribe(Flowable.java:13234)
                                                                                     at io.reactivex.Flowable.subscribe(Flowable.java:13180)
                                                                                     at io.reactivex.internal.operators.flowable.FlowableFlatMapPublisher.subscribeActual(FlowableFlatMapPublisher.java:43)
                                                                                     at io.reactivex.Flowable.subscribe(Flowable.java:13234)
                                                                                     at io.reactivex.internal.operators.flowable.FlowableElementAtSingle.subscribeActual(FlowableElementAtSingle.java:41)
                                                                                     at io.reactivex.Single.subscribe(Single.java:3096)
                                                                                     at io.reactivex.Single.subscribeWith(Single.java:3140)
                                                                                     at com.polidea.rxandroidble2.internal.operations.ConnectOperation$4.subscribe(ConnectOperation.java:144)
                                                                                     at io.reactivex.internal.operators.single.SingleCreate.subscribeActual(SingleCreate.java:39)
                                                                                     at io.reactivex.Single.subscribe(Single.java:3096)
                                                                                     at io.reactivex.internal.operators.single.SingleTimeout.subscribeActual(SingleTimeout.java:53)
                                                                                     at io.reactivex.Single.subscribe(Single.java:3096)
                                                                                     at io.reactivex.internal.operators.single.SingleDoFinally.subscribeActual(SingleDoFinally.java:46)
                                                                                     at io.reactivex.Single.subscribe(Single.java:3096)
                                                                                     at io.reactivex.Single.subscribeWith(Single.java:3140)
                                                                                     at com.polidea.rxandroidble2.internal.operations.ConnectOperation.protectedRun(ConnectOperation.java:79)
                                                                                     at com.polidea.rxandroidble2.internal.QueueOperation$1.subscribe(QueueOperation.java:41)
                                                                                     at io.reactivex.internal.operators.observable.ObservableCreate.subscribeActual(ObservableCreate.java:40)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
                                                                                     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:237)
                                                                                     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                                     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                                     at java.lang.Thread.run(Thread.java:761)
                                                                                  Caused by: com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from AA:BB:CC:11:22:33
                                                                                     at com.polidea.rxandroidble2.internal.connection.DisconnectionRouter$1.apply(DisconnectionRouter.java:38)
                                                                                     at com.polidea.rxandroidble2.internal.connection.DisconnectionRouter$1.apply(DisconnectionRouter.java:35)
                                                                                     at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:59)
                                                                                     at io.reactivex.internal.operators.observable.ObservableFilter$FilterObserver.onNext(ObservableFilter.java:52)
                                                                                     at io.reactivex.internal.operators.observable.ObservableConcatMap$ConcatMapDelayErrorObserver.drain(ObservableConcatMap.java:464)
                                                                                     at io.reactivex.internal.operators.observable.ObservableConcatMap$ConcatMapDelayErrorObserver.onSubscribe(ObservableConcatMap.java:324)
                                                                                     at io.reactivex.internal.operators.observable.ObservableFromArray.subscribeActual(ObservableFromArray.java:30)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.internal.operators.observable.ObservableConcatMap.subscribeActual(ObservableConcatMap.java:54)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
03-08 14:47:18.328 11563-11586/com.polidea.rxandroidble.sample E/AndroidRuntime:     at io.reactivex.internal.operators.observable.ObservableFilter.subscribeActual(ObservableFilter.java:30)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:33)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:162)
                                                                                     at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
                                                                                     at io.reactivex.internal.operators.observable.ObservableFromArray$FromArrayDisposable.run(ObservableFromArray.java:107)
                                                                                     at io.reactivex.internal.operators.observable.ObservableFromArray.subscribeActual(ObservableFromArray.java:36)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.internal.operators.observable.ObservableFlatMap.subscribeActual(ObservableFlatMap.java:55)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.internal.operators.observable.ObservableElementAt.subscribeActual(ObservableElementAt.java:36)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.internal.operators.observable.ObservableCache$CacheState.connect(ObservableCache.java:216)
                                                                                     at io.reactivex.internal.operators.observable.ObservableCache.subscribeActual(ObservableCache.java:82)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11180)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11058)
                                                                                     at com.polidea.rxandroidble2.internal.connection.DisconnectionRouter.<init>(DisconnectionRouter.java:60)
                                                                                     at com.polidea.rxandroidble2.internal.connection.DisconnectionRouter_Factory.get(DisconnectionRouter_Factory.java:33)
                                                                                     at com.polidea.rxandroidble2.internal.connection.DisconnectionRouter_Factory.get(DisconnectionRouter_Factory.java:10)
                                                                                     at bleshadow.dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
                                                                                     at com.polidea.rxandroidble2.internal.connection.RxBleGattCallback_Factory.get(RxBleGattCallback_Factory.java:33)
                                                                                     at com.polidea.rxandroidble2.internal.connection.RxBleGattCallback_Factory.get(RxBleGattCallback_Factory.java:8)
                                                                                     at bleshadow.dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
                                                                                     at com.polidea.rxandroidble2.DaggerClientComponent$DeviceComponentImpl$ConnectionComponentImpl.connectOperation(DaggerClientComponent.java:713)
                                                                                     at com.polidea.rxandroidble2.internal.connection.ConnectorImpl$1.call(ConnectorImpl.java:56)
                                                                                     at com.polidea.rxandroidble2.internal.connection.ConnectorImpl$1.call(ConnectorImpl.java:41)
                                                                                     at io.reactivex.internal.operators.observable.ObservableDefer.subscribeActual(ObservableDefer.java:32)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.internal.operators.observable.ObservableDoFinally.subscribeActual(ObservableDoFinally.java:45)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.internal.operators.observable.ObservableDefer.subscribeActual(ObservableDefer.java:39)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.internal.operators.observable.ObservableTakeUntil.subscribeActual(ObservableTakeUntil.java:41)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.internal.operators.observable.ObservableObserveOn.subscribeActual(ObservableObserveOn.java:45)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.internal.operators.observable.ObservableDoFinally.subscribeActual(ObservableDoFinally.java:45)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11180)
                                                                                     at io.reactivex.Observable.subscribe(Observable.java:11109)
                                                                                     at com.polidea.rxandroidble2.sample.example2_connection.ConnectionExampleActivity.onConnectToggleClick(ConnectionExampleActivity.java:52)
03-08 14:47:18.328 11563-11586/com.polidea.rxandroidble.sample E/AndroidRuntime:     at com.polidea.rxandroidble2.sample.example2_connection.ConnectionExampleActivity_ViewBinding$1.doClick(ConnectionExampleActivity_ViewBinding.java:43)
                                                                                     at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22)
                                                                                     at android.view.View.performClick(View.java:5637)
                                                                                     at android.view.View$PerformClick.run(View.java:22429)
                                                                                     at android.os.Handler.handleCallback(Handler.java:751)
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                     at android.os.Looper.loop(Looper.java:154)
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
03-08 14:47:18.334 11563-11586/com.polidea.rxandroidble.sample D/Error: ERR: exClass=com.polidea.rxandroidble2.exceptions.BleDisconnectedException
03-08 14:47:18.334 11563-11586/com.polidea.rxandroidble.sample D/Error: ERR: exMsg=Disconnected from AA:BB:CC:11:22:33
03-08 14:47:18.334 11563-11586/com.polidea.rxandroidble.sample D/Error: ERR: file=DisconnectionRouter.java
03-08 14:47:18.334 11563-11586/com.polidea.rxandroidble.sample D/Error: ERR: class=com.polidea.rxandroidble2.internal.connection.DisconnectionRouter$1
03-08 14:47:18.334 11563-11586/com.polidea.rxandroidble.sample D/Error: ERR: method=apply line=38
03-08 14:47:18.335 11563-11586/com.polidea.rxandroidble.sample D/Error: ERR: stack=io.reactivex.exceptions.UndeliverableException: com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from AA:BB:CC:11:22:33
                                                                            at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:366)
                                                                            at io.reactivex.internal.operators.observable.ObservableUnsubscribeOn$UnsubscribeObserver.onError(ObservableUnsubscribeOn.java:67)
                                                                            at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onError(ObservableSubscribeOn.java:63)
                                                                            at io.reactivex.internal.operators.observable.ObservableCreate$CreateEmitter.tryOnError(ObservableCreate.java:85)
                                                                            at io.reactivex.internal.operators.observable.ObservableCreate$CreateEmitter.onError(ObservableCreate.java:73)
                                                                            at com.polidea.rxandroidble2.internal.util.DisposableUtil$3.onError(DisposableUtil.java:60)
                                                                            at io.reactivex.internal.operators.single.SingleDoFinally$DoFinallyObserver.onError(SingleDoFinally.java:81)
                                                                            at io.reactivex.internal.operators.single.SingleTimeout$TimeoutMainObserver.onError(SingleTimeout.java:142)
                                                                            at io.reactivex.internal.operators.single.SingleCreate$Emitter.tryOnError(SingleCreate.java:95)
                                                                            at io.reactivex.internal.operators.single.SingleCreate$Emitter.onError(SingleCreate.java:81)
                                                                            at com.polidea.rxandroidble2.internal.util.DisposableUtil$1.onError(DisposableUtil.java:24)
                                                                            at io.reactivex.internal.operators.flowable.FlowableElementAtSingle$ElementAtSubscriber.onError(FlowableElementAtSingle.java:101)
                                                                            at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.checkTerminate(FlowableFlatMap.java:566)
                                                                            at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.drainLoop(FlowableFlatMap.java:374)
                                                                            at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.drain(FlowableFlatMap.java:366)
                                                                            at io.reactivex.internal.operators.flowable.FlowableFlatMap$MergeSubscriber.innerError(FlowableFlatMap.java:605)
                                                                            at io.reactivex.internal.operators.flowable.FlowableFlatMap$InnerSubscriber.onError(FlowableFlatMap.java:668)
                                                                            at io.reactivex.internal.operators.single.SingleToFlowable$SingleToFlowableObserver.onError(SingleToFlowable.java:68)
                                                                            at io.reactivex.internal.operators.observable.ObservableElementAtSingle$ElementAtObserver.onError(ObservableElementAtSingle.java:104)
                                                                            at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.checkTerminate(ObservableFlatMap.java:495)
                                                                            at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drainLoop(ObservableFlatMap.java:331)
                                                                            at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drain(ObservableFlatMap.java:323)
                                                                            at io.reactivex.internal.operators.observable.ObservableFlatMap$InnerObserver.onError(ObservableFlatMap.java:571)
                                                                            at io.reactivex.internal.disposables.EmptyDisposable.error(EmptyDisposable.java:63)
                                                                            at io.reactivex.internal.operators.observable.ObservableError.subscribeActual(ObservableError.java:37)
                                                                            at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                            at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:162)
                                                                            at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
                                                                            at io.reactivex.internal.util.NotificationLite.accept(NotificationLite.java:246)
                                                                            at io.reactivex.internal.operators.observable.ObservableCache$ReplayDisposable.replay(ObservableCache.java:350)
                                                                            at io.reactivex.internal.operators.observable.ObservableCache.subscribeActual(ObservableCache.java:85)
                                                                            at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                            at io.reactivex.internal.operators.observable.ObservableFlatMap.subscribeActual(ObservableFlatMap.java:55)
                                                                            at io.reactivex.Observable.subscribe(Observable.java:11194)
                                                                            at io.reactivex.internal.operators.observable.ObservableElementAtSingle.subscribeActual(ObservableElementAtSingle.java:37)
                                                                            at io.reactivex.Single.subscribe(Single.java:3096)
                                                                            at io.reactivex.internal.operators.single.SingleToFlowable.subscribeActual(SingleToFlowable.java:37)
                                                                        	at io.reactivex.Flowable.subscribe(Fl
03-08 14:47:18.335 11563-11586/com.polidea.rxandroidble.sample D/Error: ERR: TOTAL BYTES WRITTEN: 25616

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:60 (15 by maintainers)

github_iconTop GitHub Comments

6reactions
dariuszseweryncommented, May 17, 2018

Hello everyone,

I was investigating this issue recently.

The root cause of the problem is the threading of Android OS — callbacks may be called on arbitrary threads. The library does not know how it will be used and thus it is routing errors to all listeners. Because the errors sometimes may be routed through many merged observables they may appear more than once in an observable chain…

One of the differences between RxJava 1 and RxJava 2 is that the former did swallow exceptions that happened after the chain was unsubscribed whereas the latter is throwing an UndeliverableException in this situation. With the current library architecture it is impossible to mitigate this behaviour and the suggested workaround is to add a code similar to what @thuytrinh wrote above:

Kotlin

RxJavaPlugins.setErrorHandler({ error ->
    if (error is UndeliverableException && error.cause is BleException) {
        return // ignore BleExceptions as they were surely delivered at least once
    }
    // add other custom handlers if needed
    throw error
})

Java

RxJavaPlugins.setErrorHandler(error -> {
    if (error instanceof UndeliverableException && error.cause instanceof BleException) {
        return; // ignore BleExceptions as they were surely delivered at least once
    }
    // add other custom handlers if needed
    throw error;
});
5reactions
streetsofbostoncommented, Mar 12, 2018

We’ve seen these BleDisconnectedExceptions wrapped in UndeliverableException in our projects for a while now, when using RxJava2.

This happens when you dispose of the subscription while a disconnect takes place. The RxAndroidBle code delivers this exception just before your code disposes of the subscription but was about to reach your just-disposed error-handler just after your code disposes of it.

We worked around this by registering an uncaught-exception handler by calling RxJavaPlugins.setErrorHandler and handling the UndeliverableException appropriately. The handler we used just logged the uncaught-exception, but did not let the app crash.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Crash when trying to connect too fast [UndeliverableException]
I too have a call to connect again directly from my onConnectionFailure handler because I generally want to re-establish the connection ASAP.
Read more >
RxJava UndeliverableException how to handle onSuccess ...
You are using Single which has the protocol onSuccess | onError . So if onSuccess crashes, it can't invoke onError on the same...
Read more >
Merging RxJava Observables considered harmful — Part 2
If the stream throws an error and the observer is already disposed, we want to crash. We want to find the underlying issue...
Read more >
The RxJava2 Default Error Handler | by Bryan Herbst - Medium
onError tries to be smart and separate library/implementation bugs from situations in which an error is undeliverable. It will leave exceptions ...
Read more >
How to fix Fortnite crash and technical issues - Epic Games
Unable to login error message. If you are trying to play Fortnite and receive this error message, it's because your system isn't loading...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found