-
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 refCount termination-reconnect race #6187
Conversation
Codecov Report
@@ Coverage Diff @@
## 2.x #6187 +/- ##
============================================
- Coverage 98.26% 98.24% -0.02%
- Complexity 6197 6203 +6
============================================
Files 667 667
Lines 44880 44888 +8
Branches 6214 6218 +4
============================================
Hits 44100 44100
- Misses 245 251 +6
- Partials 535 537 +2
Continue to review full report at Codecov.
|
public interface ResettableConnectable { | ||
|
||
/** | ||
* Reset the connectable if the current internal connection object is the |
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.
Find it hard to read and follow. Could we link the param in here so it's understandable what's the internal and what's the provided object?
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.
Changed the description.
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.
Much better.
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.
LGTM, thanks
Thanks for the fix @akarnokd and the report @BernhardReu. A release in the next couple of weeks with this change would be very welcome ( |
@davidmoten Sure. #6194 |
@akarnokd This seems to fix the issue for
The actual failure is obviously unpredictable due to the race conditions, but it usually fails pretty early. In this case, it failed at
|
This PR modifies the
refCount
operator (in bothFlowable
andObservable
types) to avoid certain termination-reconnection races.The original race could happen when the refCounted source terminated at the same time as new observers arrived, leaving those new observers hanging as they practically joined a dying connection and got possibly undercut by the
dispose
call.The change involve a new internal interface
ResettableConnection
that will allow resetting the connection object inside the connectable source if it is equal to the connection object known by the initiator of the originalconnect
call.Fixes #6185