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

2.x: Fix Flowable.concatMap backpressure w/ scalars #7091

Merged
merged 2 commits into from
Oct 5, 2020

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Oct 5, 2020

In concatMap, there is a shortcut for when the mapped Flowable turns out to be a scalar value and thus the full subscription process can be skipped. This used a so-called weak subscription that expected non-concurrent requesting to emits its single value.

Unfortunately, there is a race condition for when the downstream requests exactly when this weak subscription is activated, resulting in either double emission or no emission at all. The fix is to do the proper compareAndSet to ensure the emission happens exactly once.

Backport of #7089

@akarnokd akarnokd merged commit 3d6403b into ReactiveX:2.x Oct 5, 2020
@akarnokd akarnokd deleted the ConcatMapScalarFix2x branch October 5, 2020 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants