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

CompositeException when setting up notification #746

Open
EDLuke opened this issue Apr 23, 2021 · 1 comment
Open

CompositeException when setting up notification #746

EDLuke opened this issue Apr 23, 2021 · 1 comment
Labels
bug Bug that is caused by the library

Comments

@EDLuke
Copy link

EDLuke commented Apr 23, 2021

Describe the bug
It's very hard to reproduce this exception but we are seeing crashes caused by this in our production app. When notifications fail to be set up and at the same time a disconnection happens, RxJava seems to combine the two exceptions and throw a Fatal: CompositeException

To Reproduce
Steps to reproduce the behavior:

  1. Throw exception at NotificationAndIndicationManager.java at line 241.
  2. Disconnect the BLE peripheral

Expected behavior
Normal disconnect exception is handled and no Fatal: CompositeException that crashes the app.

Smartphone (please complete the following information):

  • Device: Any
  • OS: Any
  • Library version: 2.1.1
Fatal Exception: io.reactivex.exceptions.CompositeException: 2 exceptions occurred. 
       at io.reactivex.internal.util.ExceptionHelper.addThrowable(ExceptionHelper.java:67)
       at io.reactivex.internal.util.AtomicThrowable.addThrowable(AtomicThrowable.java:34)
       at io.reactivex.internal.operators.observable.ObservableFlatMap$InnerObserver.onError(ObservableFlatMap.java:585)
       at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.checkTerminate(ObservableFlatMap.java:511)
       at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drainLoop(ObservableFlatMap.java:334)
       at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drain(ObservableFlatMap.java:326)
       at io.reactivex.internal.operators.observable.ObservableFlatMap$InnerObserver.onError(ObservableFlatMap.java:590)
       at io.reactivex.internal.disposables.EmptyDisposable.error(EmptyDisposable.java:63)
       at io.reactivex.internal.operators.observable.ObservableError.subscribeActual(ObservableError.java:38)
       at io.reactivex.Observable.subscribe(Observable.java:12284)
       at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:165)
       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.ObservableReplay$UnboundedReplayBuffer.replay(ObservableReplay.java:553)
       at io.reactivex.internal.operators.observable.ObservableReplay$ReplayObserver.replay(ObservableReplay.java:401)
       at io.reactivex.internal.operators.observable.ObservableReplay$ReplayObserver.onNext(ObservableReplay.java:366)
       at io.reactivex.internal.operators.observable.ObservableDoOnEach$DoOnEachObserver.onNext(ObservableDoOnEach.java:101)
       at io.reactivex.internal.operators.observable.ObservableElementAt$ElementAtObserver.onNext(ObservableElementAt.java:86)
       at com.jakewharton.rxrelay2.BehaviorRelay$BehaviorDisposable.test(BehaviorRelay.java:364)
       at com.jakewharton.rxrelay2.BehaviorRelay$BehaviorDisposable.emitNext(BehaviorRelay.java:358)
       at com.jakewharton.rxrelay2.BehaviorRelay.accept(BehaviorRelay.java:135)
       at com.polidea.rxandroidble2.internal.connection.DisconnectionRouter.onDisconnectedException(DisconnectionRouter.java:110)
       at com.polidea.rxandroidble2.internal.connection.RxBleGattCallback$2.onConnectionStateChange(RxBleGattCallback.java:81)
       at android.bluetooth.BluetoothGatt$1$4.run(BluetoothGatt.java:272)
       at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:780)
       at android.bluetooth.BluetoothGatt.access$200(BluetoothGatt.java:41)
       at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:267)
       at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:192)
       at android.os.Binder.execTransactInternal(Binder.java:1159)
       at android.os.Binder.execTransact(Binder.java:1123)

Caused by com.polidea.rxandroidble2.exceptions.BleCannotSetCharacteristicNotificationException: Cannot write client characteristic config descriptor (code 3) with characteristic UUID ********-****-****-****-************
       at com.polidea.rxandroidble2.internal.connection.NotificationAndIndicationManager$7.apply(NotificationAndIndicationManager.java:241)
       at com.polidea.rxandroidble2.internal.connection.NotificationAndIndicationManager$7.apply(NotificationAndIndicationManager.java:238)
       at io.reactivex.internal.operators.completable.CompletableResumeNext$ResumeNextObserver.onError(CompletableResumeNext.java:82)
       at io.reactivex.internal.operators.observable.ObservableIgnoreElementsCompletable$IgnoreObservable.onError(ObservableIgnoreElementsCompletable.java:61)
       at io.reactivex.internal.operators.observable.ObservableCreate$CreateEmitter.tryOnError(ObservableCreate.java:84)
       at com.polidea.rxandroidble2.internal.serialization.ConnectionOperationQueueImpl.flushQueue(ConnectionOperationQueueImpl.java:95)
       at com.polidea.rxandroidble2.internal.serialization.ConnectionOperationQueueImpl$1.run(ConnectionOperationQueueImpl.java:86)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       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)

Caused by com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from MAC='C3:94:7B:7F:57:XX' with status 8 (GATT_INSUF_AUTHORIZATION or GATT_CONN_TIMEOUT)
       at com.polidea.rxandroidble2.internal.connection.RxBleGattCallback$2.onConnectionStateChange(RxBleGattCallback.java:81)
       at android.bluetooth.BluetoothGatt$1$4.run(BluetoothGatt.java:272)
       at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:780)
       at android.bluetooth.BluetoothGatt.access$200(BluetoothGatt.java:41)
       at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:267)
       at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:192)
       at android.os.Binder.execTransactInternal(Binder.java:1159)
       at android.os.Binder.execTransact(Binder.java:1123)
@EDLuke EDLuke added the bug Bug that is caused by the library label Apr 23, 2021
@dariuszseweryn
Copy link
Owner

A workaround for this is to set a RxJavaPlugins error handler and catch the CompositeException there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that is caused by the library
Projects
None yet
Development

No branches or pull requests

2 participants