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 PublishSubject non-deterministic behavior on concurrent modification #288

Merged

Conversation

benjchristensen
Copy link
Member

  • changed to take snapshot of observers.values() before iterating in onNext/onError/onCompleted so that nested subscriptions that add to observers can't change the values() iteration
  • single-threaded nested subscriptions are now deterministic
  • multi-threaded subscriptions will no longer be allowed to race to get into an interating onNext/onError/onCompleted loop, they will always wait until the next
  • also improved terminal state behavior when subscribing to a PublishSubject that has already received onError/onCompleted

#282

- changed to take snapshot of observers.values() before iterating in onNext/onError/onCompleted so that nested subscriptions that add to observers can't change the values() iteration
- single-threaded nested subscriptions are now deterministic
- multi-threaded subscriptions will no longer be allowed to race to get into an interating onNext/onError/onCompleted loop, they will always wait until the next
- also improved terminal state behavior when subscribing to a PublishSubject that has already received onError/onCompleted

ReactiveX#282
@cloudbees-pull-request-builder

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

- remove the race condition that existed between a subscription coming in while onError/onCompleted was being called
@cloudbees-pull-request-builder

RxJava-pull-requests #161 FAILURE
Looks like there's a problem with this pull request

benjchristensen added a commit that referenced this pull request Jun 5, 2013
Fix PublishSubject non-deterministic behavior on concurrent modification
@benjchristensen benjchristensen merged commit 870d0b7 into ReactiveX:master Jun 5, 2013
rickbw pushed a commit to rickbw/RxJava that referenced this pull request Jan 9, 2014
…hSubject

Fix PublishSubject non-deterministic behavior on concurrent modification
jihoonson pushed a commit to jihoonson/RxJava that referenced this pull request Mar 6, 2020
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