Skip to content
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 window(Observable|Callable) upstream handling #5887

Merged
merged 1 commit into from
Mar 4, 2018

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Mar 4, 2018

This PR fixes the upstream handling in Observable.window(ObservableSource) and Observable.window(Callable<ObservableSource>) operators to make sure if both the main output and the inner windows have been disposed, the upstream is also disposed.

Fixes #5881.

Remark:

There are a couple of w != null checks showing up as partially covered. In theory, with the right interleaving, w can become null, but unfortunately the usual TestHelper.race() testing is unlikely to trigger that case. There would be a higher chance with 3 threads (one disposing, one completing the main and one completing the inner window) but the current CI is effectively 1.5 - 2 cores/threads that tend to not produce a thorough interleaving.

@akarnokd akarnokd added this to the 2.2 milestone Mar 4, 2018
@codecov
Copy link

codecov bot commented Mar 4, 2018

Codecov Report

Merging #5887 into 2.x will increase coverage by 0.07%.
The diff coverage is 97.98%.

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #5887      +/-   ##
============================================
+ Coverage     97.43%   97.51%   +0.07%     
- Complexity     5946     5948       +2     
============================================
  Files           655      655              
  Lines         43877    43900      +23     
  Branches       6109     6108       -1     
============================================
+ Hits          42752    42807      +55     
+ Misses          348      340       -8     
+ Partials        777      753      -24
Impacted Files Coverage Δ Complexity Δ
...s/observable/ObservableWindowBoundarySupplier.java 97.95% <97.22%> (+8.32%) 2 <1> (ø) ⬇️
...operators/observable/ObservableWindowBoundary.java 99.21% <98.9%> (+11.18%) 2 <1> (ø) ⬇️
...ernal/operators/flowable/FlowableFlatMapMaybe.java 88.88% <0%> (-5.32%) 2% <0%> (ø)
.../operators/observable/ObservableFlatMapSingle.java 88.8% <0%> (-5.23%) 2% <0%> (ø)
...nternal/operators/parallel/ParallelReduceFull.java 91.17% <0%> (-3.93%) 2% <0%> (ø)
...java/io/reactivex/processors/PublishProcessor.java 98.23% <0%> (-1.77%) 43% <0%> (-1%)
...ernal/operators/flowable/FlowableFromIterable.java 95.18% <0%> (-1.07%) 5% <0%> (ø)
...ava/io/reactivex/processors/BehaviorProcessor.java 95.96% <0%> (-0.9%) 59% <0%> (-1%)
...perators/single/SingleFlatMapIterableFlowable.java 96.66% <0%> (-0.84%) 2% <0%> (ø)
...ernal/operators/flowable/FlowableTimeoutTimed.java 98.37% <0%> (-0.82%) 3% <0%> (ø)
... and 15 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 a267d7e...1e476d3. Read the comment docs.

@vanniktech
Copy link
Collaborator

The issue will get closed once this PR is merged but I don't see the Flowable implementation here.

@akarnokd
Copy link
Member Author

akarnokd commented Mar 4, 2018

The issue refers to window(Observable) thus the Observable variants. I'll post a separate PR once I checked the Flowable variants.

@akarnokd akarnokd merged commit 855153e into ReactiveX:2.x Mar 4, 2018
@akarnokd akarnokd deleted the WindowBoundaryCancelManagementFix branch March 4, 2018 18:19
@akarnokd
Copy link
Member Author

akarnokd commented Mar 4, 2018

Yes, Flowable.window(Publisher) is also incorrect.

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.

Incorrect upstream management in window(Observable) and window(Callable)
2 participants