Rx2: Multiple errors in zip'ed observables throw exception
See original GitHub issueI execute multiple HTTP calls in parallel by zipping them up. Now 0…n of them can obviously fail. The thing is, when e.g. 2 calls fail at almost the exact time, error 1 is processed in doOnError
and onErrorReturnItem
but error 2 slips through and causes an exception. I think this happens if error 2 happens to come in while error 1 is still not processed entirely in those two onError operators.
It can be reproduced with the following simplified code:
buttonClick.flatMapSingle(action -> Single.zip(
Single.error(new Throwable("error 1")).delay(500, TimeUnit.MILLISECONDS),
Single.error(new Throwable("error 2")).delay(500, TimeUnit.MILLISECONDS),
(integer, integer2) -> true
)
.doOnError(t -> Timber.d(t.getMessage()))
.onErrorReturnItem(true))
.subscribe();
So every once in a while this would throw:
D/Main: error 1
W/System.err: java.lang.Throwable: error 2
Shouldn’t the Single.zip
stream only be allowed to emit one error?
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
RxJava2: Multiple errors in zip'ed observables throw exception
Show activity on this post. I execute multiple HTTP calls in parallel by zipping them up. Now 0..n of them can obviously fail....
Read more >RxJava and Error Handling - Baeldung
See how to deal with errors using RxJava. ... First, keep in mind that the Observable typically does not throw exceptions.
Read more >RxRatpack (Ratpack API (2.0.0-rc-1))
Converts an Observable into a Promise , for all of the observable's items. This method can be used to simply adapt an observable...
Read more >kotlinx-coroutines-rx2
Flow.asObservable, Observable, Converts the given flow to a cold Observable. ... Awaits for the value of the maybe and returns it or throws...
Read more >Error Handling With Observable Sequences | RxJS
With the retry operator, we can try a certain operation a number of times before an error is thrown. This is useful when...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It doesn’t seem to be happening with
Observable.zip()
, so I don’t know if that behavior makes sense…I’m closing this issue due to inactivity. If you have further input on the issue, don’t hesitate to reopen this issue or post a new one.