2.x: BehaviorProcessor & Subject terminate-subscribe race#5281
Merged
akarnokd merged 2 commits intoReactiveX:2.xfrom Apr 12, 2017
Merged
2.x: BehaviorProcessor & Subject terminate-subscribe race#5281akarnokd merged 2 commits intoReactiveX:2.xfrom
akarnokd merged 2 commits intoReactiveX:2.xfrom
Conversation
artem-zinnatullin
approved these changes
Apr 12, 2017
|
|
||
| TestHelper.race(r1, r2); | ||
|
|
||
| ts.assertError(TestException.class); |
Contributor
There was a problem hiding this comment.
assertFailure()? it also checks that no completion events were emitted
Codecov Report
@@ Coverage Diff @@
## 2.x #5281 +/- ##
============================================
- Coverage 96.12% 96.01% -0.11%
+ Complexity 5755 5745 -10
============================================
Files 628 628
Lines 41079 41077 -2
Branches 5699 5699
============================================
- Hits 39486 39441 -45
- Misses 631 653 +22
- Partials 962 983 +21
Continue to review full report at Codecov.
|
vanniktech
approved these changes
Apr 12, 2017
Collaborator
vanniktech
left a comment
There was a problem hiding this comment.
UnicastSubject as well as SerializedSubject still have the boolean done. Should those be changed for consistency too?
Member
Author
|
No need for that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes the race condition in
BehaviorProcessorandBehaviorSubjectwhenonComplete()oronError()is called concurrently withsubscribeand the consumer throws aNullPointerExceptioninstead of relaying the terminal event.The fix involves having a separate
terminalEventatomic field, CAS-ing in the actual or markerThrowableand reading that field insubscribe.