Update BlockingFlowableIterable.onNext() to set error before cancel#7789
Merged
akarnokd merged 1 commit intoReactiveX:3.xfrom Nov 21, 2024
Merged
Update BlockingFlowableIterable.onNext() to set error before cancel#7789akarnokd merged 1 commit intoReactiveX:3.xfrom
akarnokd merged 1 commit intoReactiveX:3.xfrom
Conversation
To avoid race with hasNext(), which checks for cancel first before checking for error. For example, in the following case, hasNext() may return false to the caller, making the caller assume the iterable finished successfully. 1. onNext() called cancel 2. hasNext() found the iterable is cancelled 3. hasNext() found that error is null thus returned false to the caller, without throwing the error 4. onNext() set error
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 3.x #7789 +/- ##
=========================================
Coverage 99.62% 99.62%
Complexity 6801 6801
=========================================
Files 752 752
Lines 47707 47711 +4
Branches 6401 6402 +1
=========================================
+ Hits 47527 47532 +5
+ Misses 84 81 -3
- Partials 96 98 +2 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
Contributor
Author
|
Thanks for the review! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To avoid race with hasNext(), which checks for cancel first before checking for error. For example, in the following case, hasNext() may return false to the caller, making the caller assume the iterable finished successfully.
It's a bit hard to test this race condition in unit tests. Existing tests can make sure no regression is introduced.