Skip to content

2.x: UnicastSubject fix for the child becoming visible before onSubscribe is called. #3381

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

Closed
wants to merge 1 commit into from

Conversation

akarnokd
Copy link
Member

Discovered while the test NbpOperatorConcatTest.testIssue2890NoStackoverflow hung on Travis.

What happened is that the reference to the child became visible before the call to its onSubscribe method so a concurrent source emitting at the exact same time could already see the "unstarted" child. The PR fixes this in both NbpUnicastSubject and UnicastSubject by changing the order of calls. The rest of the subjects behave correctly (call onSubscribe first, make child visible second).

In addition, UnicastSubject now calls drain() because when the onSubscribe calls request and drain, the child is not visible and nothing gets replayed. Once both onSubscribe call returns and the child is becomes visible, a call to drain again will now correctly replay all available contents that were requested.

@akarnokd
Copy link
Member Author

akarnokd commented Feb 4, 2016

Closing, will be included in the complete backport PR.

@akarnokd akarnokd closed this Feb 4, 2016
@akarnokd akarnokd deleted the UnicastSubjectFix2x branch May 18, 2016 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant