-
Notifications
You must be signed in to change notification settings - Fork 7.6k
2.x: BehaviorProcessor & Subject terminate-subscribe race #5281
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
Conversation
|
|
||
| TestHelper.race(r1, r2); | ||
|
|
||
| ts.assertError(TestException.class); |
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.
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
left a comment
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.
UnicastSubject as well as SerializedSubject still have the boolean done. Should those be changed for consistency too?
|
No need for that. |
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.