Skip to content
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

Fix ReplaySubject Terminal State Race Condition #1150

Merged
merged 2 commits into from
May 5, 2014

Conversation

benjchristensen
Copy link
Member

Fixes #1147 (comment) with change from @akarnokd

@benjchristensen
Copy link
Member Author

Unit test to assert this is:

    @Test
    public void testRaceForTerminalState() {
        final List<Integer> expected = Arrays.asList(1);
        for (int i = 0; i < 1000000; i++) {
            TestSubscriber<Integer> ts = new TestSubscriber<Integer>();
            Observable.just(1).subscribeOn(Schedulers.computation()).cache().subscribe(ts);
            ts.awaitTerminalEvent();
            ts.assertReceivedOnNext(expected);
            ts.assertTerminalEvent();
        }
    }

I am including that test with a smaller loop size. If this bug were to return that test should non-deterministically fail, even with the smaller loop.

benjchristensen added a commit that referenced this pull request May 5, 2014
Fix ReplaySubject Terminal State Race Condition
@benjchristensen benjchristensen merged commit f0404e9 into ReactiveX:master May 5, 2014
@benjchristensen benjchristensen deleted the replay-fix branch May 5, 2014 20:41
@cloudbees-pull-request-builder

RxJava-pull-requests #1068 SUCCESS
This pull request looks good

@cloudbees-pull-request-builder

RxJava-pull-requests #1069 SUCCESS
This pull request looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants