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

3.x: Fix refCount not resetting when termination triggers cross-cancel #6609

Merged
merged 1 commit into from
Aug 3, 2019

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Aug 2, 2019

This PR fixes both refCount implementation to properly reset the source when the source terminates multiple consumers.

In the original, when the source terminated multiple sources, the first termination handler cleared the connection but since the --subscriberCount wasn't zero, the source was not reset. If this termination triggered a cancel on the second consumer, that path would not get the source reset either due to losing the connection object. Unfortunately, one can't just take the first termination handler and reset there immediately either because that could disrupt the termination of the rest of the consumers. It has to wait for the source to terminate all consumers or have the consumers cancel all.

This affects 2.x and will be backported in a separate PR.

Fixes #6608

@akarnokd akarnokd added this to the 3.0 milestone Aug 2, 2019
@akarnokd akarnokd closed this Aug 3, 2019
@akarnokd akarnokd reopened this Aug 3, 2019
@codecov
Copy link

codecov bot commented Aug 3, 2019

Codecov Report

Merging #6609 into 3.x will increase coverage by 0.06%.
The diff coverage is 80%.

Impacted file tree graph

@@             Coverage Diff             @@
##                3.x   #6609      +/-   ##
===========================================
+ Coverage     98.23%   98.3%   +0.06%     
+ Complexity     6185    6181       -4     
===========================================
  Files           678     678              
  Lines         44908   44910       +2     
  Branches       6214    6214              
===========================================
+ Hits          44117   44150      +33     
+ Misses          261     251      -10     
+ Partials        530     509      -21
Impacted Files Coverage Δ Complexity Δ
...ernal/operators/observable/ObservableRefCount.java 98.97% <80%> (-1.03%) 22 <0> (-2)
.../internal/operators/flowable/FlowableRefCount.java 98.98% <80%> (-1.02%) 22 <0> (-2)
.../io/reactivex/disposables/CompositeDisposable.java 98.14% <0%> (-1.86%) 39% <0%> (-1%)
...ernal/operators/flowable/FlowableFlatMapMaybe.java 94.68% <0%> (-0.97%) 2% <0%> (ø)
...ternal/operators/observable/ObservablePublish.java 99.09% <0%> (-0.91%) 17% <0%> (-1%)
...nternal/operators/parallel/ParallelSortedJoin.java 94.89% <0%> (-0.73%) 2% <0%> (ø)
...x/internal/operators/flowable/FlowableGroupBy.java 95.51% <0%> (-0.57%) 3% <0%> (ø)
...activex/internal/schedulers/ExecutorScheduler.java 98% <0%> (-0.5%) 10% <0%> (ø)
...internal/operators/flowable/FlowableObserveOn.java 96.65% <0%> (-0.28%) 3% <0%> (ø)
...x/internal/operators/flowable/FlowablePublish.java 98.52% <0%> (ø) 17% <0%> (-1%) ⬇️
... and 22 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 eae8280...2644e3b. Read the comment docs.

@akarnokd akarnokd merged commit 28e24dc into ReactiveX:3.x Aug 3, 2019
@akarnokd akarnokd deleted the RefCountTerminatioCancelFix3x branch August 3, 2019 08:24
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.

ReplaySubject and buffer with debounce not emitting values after first subscription
2 participants