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 Observable.range race condition #2892

Merged
merged 1 commit into from
Apr 20, 2015
Merged

Conversation

davidmoten
Copy link
Collaborator

In RangeProducer if the first two requests come concurrently and are both for Long.MAX_VALUE then there is a possible race condition where the fast path is started twice thus emitting some or all elements twice.

This PR fixes the race by only allowing the fast path if the current request count is 0 (using compareAndSet).

…ong.MAX_VALUE and both start the fast path thus possibly some items more than once
@davidmoten
Copy link
Collaborator Author

If this is right I'll submit another PR for OnSubscribeFromIterable which has the same problem.

@akarnokd
Copy link
Member

Looks good. Thanks.

akarnokd added a commit that referenced this pull request Apr 20, 2015
Fix Observable.range race condition
@akarnokd akarnokd merged commit aefdebb into ReactiveX:1.x Apr 20, 2015
@akarnokd akarnokd added the Bug label Apr 20, 2015
@benjchristensen benjchristensen mentioned this pull request Apr 30, 2015
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.

2 participants