-
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: BehaviorProcessor & Subject terminate-subscribe race #5281
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.
|
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
BehaviorProcessor
andBehaviorSubject
whenonComplete()
oronError()
is called concurrently withsubscribe
and the consumer throws aNullPointerException
instead of relaying the terminal event.The fix involves having a separate
terminalEvent
atomic field, CAS-ing in the actual or markerThrowable
and reading that field insubscribe
.