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.from(Iterable) race condition #2895

Merged
merged 1 commit into from
Apr 20, 2015

Conversation

davidmoten
Copy link
Collaborator

In IterableProducer 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).

… calls to the Producer.request with Long.MAX_VALUE could start the fast path twice
@akarnokd
Copy link
Member

Thanks!

akarnokd added a commit that referenced this pull request Apr 20, 2015
Fix Observable.from(Iterable) race condition
@akarnokd akarnokd merged commit 9d90aed into ReactiveX:1.x Apr 20, 2015
@davidmoten davidmoten deleted the from-iter-race branch April 21, 2015 06:32
@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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants