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 data race in StackCompletion #211

Merged
merged 1 commit into from
Dec 26, 2024
Merged

Fix data race in StackCompletion #211

merged 1 commit into from
Dec 26, 2024

Conversation

chrisvest
Copy link
Owner

When StackCompletion is used as a Flow.Publisher, new subscribers would be added to the stack before the onSubscribe method had been called. This allowed onComplete callbacks to arrive before the subscriber had subscribed, and lead to NullPointerExceptions in the onComplete because the BaseSubscriber.subscription was null.

The fix is to call onSubscribe before adding the node to the stack.

When StackCompletion is used as a Flow.Publisher, new subscribers would be added to the stack before the onSubscribe method had been called.
This allowed onComplete callbacks to arrive before the subscriber had subscribed, and lead to NullPointerExceptions in the onComplete because the BaseSubscriber.subscription was null.

The fix is to call onSubscribe before adding the node to the stack.
@chrisvest chrisvest merged commit 561af9a into main Dec 26, 2024
13 checks passed
@chrisvest chrisvest deleted the stack-comp-fix branch December 26, 2024 19:15
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.

1 participant