Marcelo Hernandez
10/12/2020, 9:00 PMObservableSource.asFlow()
has proven, at least for me, to be quite unsafe and can even crash your app. I have several stack traces in https://github.com/Kotlin/kotlinx.coroutines/issues/2104.combine
or flatMapLatest
, or any operators that cause downstream cancellations where ObservableSource.asFlow()
is used in the downstream may run into race conditions where the Coroutine might get cancelled concurrently while the Rx Observable
is still emitting, causing a JobCancellationException
or a ChildCancelledException
.wbertan
10/13/2020, 8:08 AMdispose
which then something finished and throw exception and I got io.reactivex.exceptions.UndeliverableException
(The code contains a proper error handler - where usually was the reason for this error)
So I found this issue in GitHub: https://github.com/ReactiveX/RxJava/issues/4991 with this comment:
This is by design, your Callable crashes and the downstream has disposed so the operator routes the error to the global error handler as it can’t know if the exception is relevant or not. Don’t crash into RxJava and consider using create() with emitter.tryOnError() instead.
Caused by retrofit2.adapter.rxjava2.HttpException
HTTP 404 Client Error
So not sure if in my case I would be able to handle better as the comment suggests with create()
and `emitter.tryOnError()`…
Anyway, it was the first time we notice this kind of Exception like this, and it was in our Alpha build (internal), so we will keep an eye and if becomes more often we will act on it.Marcelo Hernandez
10/23/2020, 7:17 PMObservableSource.asFlow()
crasher has been fixed and will be included in the Coroutines 1.4 release 🎉
https://github.com/Kotlin/kotlinx.coroutines/pull/2333
Thanks @louiscad, @Tash, and @Vsevolod Tolstopyatov [JB] 👏