-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
2.x: Fix Observable.switchMap main onError not disposing the current inner source #5833
Conversation
Codecov Report
@@ Coverage Diff @@
## 2.x #5833 +/- ##
============================================
+ Coverage 96.42% 96.44% +0.01%
+ Complexity 5816 5815 -1
============================================
Files 634 634
Lines 41761 41760 -1
Branches 5796 5796
============================================
+ Hits 40268 40275 +7
+ Misses 578 573 -5
+ Partials 915 912 -3
Continue to review full report at Codecov.
|
@@ -131,15 +131,15 @@ public void onNext(T t) { | |||
|
|||
@Override | |||
public void onError(Throwable t) { | |||
if (done || !errors.addThrowable(t)) { | |||
if (!done && errors.addThrowable(t)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not that I think code in the patch is broken, but that if we had test that was trying to go into onError
when it's already done == true
, we would have a hint that original code had some problems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That line is tested but parallelism on the CI is flaky and may not produce the necessary interleaving there.
The upstream may onError after a crash in the mapper thus we have to route that into the global error handler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we test it just by breaking RS protocol with main.onComplete(); main.onError()
?
I might miss something, reviewing on mobile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
Observable.switchMap
had bad logic in its mainonError
handler which didn't dispose the current innerObservable
.The
Flowable
version didn't have this logic error. Both variants received an unit test to verify the correct behavior.Fixes #5832.