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

Crashing while calling LogDna.log #5

Open
RethinavelPillai opened this issue Mar 15, 2021 · 0 comments
Open

Crashing while calling LogDna.log #5

RethinavelPillai opened this issue Mar 15, 2021 · 0 comments

Comments

@RethinavelPillai
Copy link

com.mazenrashed.logdnaandroidclient.LogDna$log$1.accept (LogDna.java:47)
com.mazenrashed.logdnaandroidclient.LogDna$log$1.accept (LogDna.java:15)
io.reactivex.internal.observers.ConsumerSingleObserver.onSuccess (ConsumerSingleObserver.java:62)
io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.onSuccess (SingleSubscribeOn.java:68)
io.reactivex.internal.operators.observable.ObservableSingleSingle$SingleElementObserver.onComplete (ObservableSingleSingle.java:109)
retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual (CallExecuteObservable.java:52)
io.reactivex.Observable.subscribe (Observable.java:12284)
io.reactivex.internal.operators.observable.ObservableSingleSingle.subscribeActual (ObservableSingleSingle.java:35)
io.reactivex.Single.subscribe (Single.java:3666)
io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run (SingleSubscribeOn.java:89)
io.reactivex.Scheduler$DisposeTask.run (Scheduler.java:608)
io.reactivex.internal.schedulers.ScheduledRunnable.run (ScheduledRunnable.java:66)
io.reactivex.internal.schedulers.ScheduledRunnable.call (ScheduledRunnable.java:57)

Possible Solution :

 
dispose of a stream that uses subscribeOn also disposes of the thread used. This also involves calling Thread.interrupt() when using Schedulers.io(). This causes the exception in your case.
InterruptedException is an Exception thrown by Thread.sleep, so it is caught by your code and passed to onError like any other exception.
Calling onError after dispose redirects the error to the global error handler due to RxJava2's policy of NEVER throwing away errors. To work around this check subscriber.isDisposed() before calling onError or use RxJava 2.1.1's new subscriber.tryOnError.

if (!subscriber.isDisposed()) {
  subscriber.onError(exception)

}```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant