2.x: .zipWith() with the same shared source crashes the app
See original GitHub issueThe following code crashes the app with a IllegalStateException
(using version 2.1.3):
Observable myObservable = Observable.just(1)
.flatMap(i -> {
throw new IllegalStateException();
}).share();
myObservable
.zipWith(myObservable, Pair::new)
.subscribe(pair -> {
//ignore
}, throwable -> {
//ignore
});
If I comment the .zipWith(myObservable, Pair::new)
line, then everything works. Is that the expected behavior?
In trying to investigate the issue, the PublishObserver
object on onError(Throwable e)
loops through 2 inner disposables, both containing the same instance of ZipCoordinator
.
The first time the publish observer propagates the error to inner.child.onError(e)
, the zip coordinator sets itself to 0 on innerError(...)
:
void innerError(Throwable ex, int index) {
if (getAndSet(0) > 0) {
disposeExcept(index);
actual.onError(ex);
} else {
RxJavaPlugins.onError(ex);
}
}
But since inner.child.onError(e)
is called again, it gets propagated to RxJavaPlugins.onError(ex);
and crashes the app. It seems to me since this is a shared source, that the error should be propagated only once, no?
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
What can we do about a randomly crashing app without ...
This VB6 DLL is kicked off by 2-3 function calls from a VB Script. Obviously, I can modify the VB Script to add...
Read more >App Crash when using print of UIPrintInteractionController
I created a new iOS App running it on Simulator iPhone 12/iOS 15 with the following code: let a4Document = Bundle.main.url(forResource: "A4" ...
Read more >SciDAVis Activity - SourceForge
Today, I received a notice from my anti-virus software in the newly installed scidavis app. Is this right? Does anyone else got similar...
Read more >AppDynamics App iQ Platform AppDynamics Platform
The app server agent collects metrics about applications and identifies applications, tiers, and nodes with slow transactions,.
Read more >6 Troubleshoot System Crashes - Java - Oracle Help Center
Crashes caused by bugs in the Java HotSpot VM or in the Java SE library code are rare. This chapter provides suggestions about...
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
I agree but then the error should be propagated down from the
.zipWith()
like I tried here. As it is in my original example, I have “one” observer but RxJava is trying to propagate the same error twice.The original reactive concept defines max one error per
Observer
and we can’t do much about that: we either drop it, send it to some handler or the user doesn’t let an exception bubble back into RxJava. That’s whatio.reactivex.Notification<T>
should allow you: turning an error into an item.