Skip to content

2.x: fix flatMap emitting the terminal exception indicator on cancel#5188

Merged
akarnokd merged 1 commit intoReactiveX:2.xfrom
akarnokd:FlatMapNoTerminatedException
Mar 16, 2017
Merged

2.x: fix flatMap emitting the terminal exception indicator on cancel#5188
akarnokd merged 1 commit intoReactiveX:2.xfrom
akarnokd:FlatMapNoTerminatedException

Conversation

@akarnokd
Copy link
Member

This PR fixes the case when Flowable.flatMap and Observable.flatMap would emit the ExceptionHelper.TERMINTED indicator exception to downstream due to emission-cancellation race.

Reported on StackOverflow.

@codecov
Copy link

codecov bot commented Mar 15, 2017

Codecov Report

Merging #5188 into 2.x will decrease coverage by 0.04%.
The diff coverage is 73.33%.

@@             Coverage Diff              @@
##                2.x    #5188      +/-   ##
============================================
- Coverage     95.98%   95.94%   -0.05%     
- Complexity     5665     5667       +2     
============================================
  Files           621      621              
  Lines         40340    40346       +6     
  Branches       5616     5620       +4     
============================================
- Hits          38722    38711      -11     
- Misses          638      653      +15     
- Partials        980      982       +2
Impacted Files Coverage Δ Complexity Δ
...x/internal/operators/flowable/FlowableFlatMap.java 88.09% <71.42%> (+0.09%) 4 <0> (ø)
...ternal/operators/observable/ObservableFlatMap.java 83.93% <75%> (+1.15%) 3 <0> (ø)
...a/io/reactivex/processors/SerializedProcessor.java 89.36% <0%> (-8.52%) 26% <0%> (-2%)
...in/java/io/reactivex/subjects/BehaviorSubject.java 83.93% <0%> (-6.74%) 55% <0%> (-1%)
...ex/internal/operators/maybe/MaybeTimeoutMaybe.java 94.11% <0%> (-4.42%) 2% <0%> (ø)
...erators/completable/CompletableConcatIterable.java 95.91% <0%> (-4.09%) 2% <0%> (ø)
...ernal/operators/flowable/FlowableFromIterable.java 94.11% <0%> (-3.75%) 5% <0%> (ø)
...internal/operators/completable/CompletableAmb.java 94.91% <0%> (-3.39%) 10% <0%> (-1%)
...ternal/operators/completable/CompletableCache.java 96.96% <0%> (-3.04%) 23% <0%> (-1%)
.../operators/observable/ObservableFlatMapSingle.java 94.02% <0%> (-2.99%) 2% <0%> (ø)
... and 35 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2d03fa9...6f6a1b4. Read the comment docs.

@akarnokd
Copy link
Member Author

flatMap is one of the few operators where it is extremely difficult to make sure certain lines get executed and this probabilistic nature may rarely manifest itself on the slow CI.

@akarnokd akarnokd merged commit db75e89 into ReactiveX:2.x Mar 16, 2017
@akarnokd akarnokd deleted the FlatMapNoTerminatedException branch March 16, 2017 08:26
@JadenChoi
Copy link

@akarnokd thanks for the fix for FlatMap, but is there a possibility that we have a similar issue with FlatMapCompletable?

On the same StackOverflow thread, Nantoka commented:

Had the strange exception with Rx Java 2.2.8 as well. I had a flatmapComplete operator wrapped into a flatmapComplete operator. After replacing this with a flatmap followed by a flatmapComplete the error seems to have disappeared. Is say "seems" as the error happened sporadically.

And we are seeing very similar exception for FlatMapCompletable on rxjava:2.2.19 but we aren't getting any useful stacktrace to share though

io.reactivex.internal.util.ExceptionHelper$Termination: No further exceptions
at unknown method(unknown file)

@akarnokd
Copy link
Member Author

akarnokd commented Mar 5, 2021

It could be. Note though that 2.x is end-of-life so can't do much about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants