Fix: Flux.zip does not emit errors from concurrent sources #4041
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.
Fixes #3917
A race condition existed where a concurrent
onComplete
signal from one source and anonError
signal from another could result in theonError
signal being dropped.Solution:
Synchronized Inner Subscriber State: The
ZipCoordinator.error()
method now takes full ownership of the termination sequence. It guarantees that the central error field is set before the inner subscriber's done flag is marked. This closes a timing window where the drain loop could previously see a done subscriber and mistakenly assume a completion.Atomic Terminal State Tie-Breaker: Enhanced the
drain()
loop logic to useExceptions.TERMINATED
as an atomic sentinel value. This acts as a definitive tie-breaker for racing terminal signals. We ensure that only the first signal (either an error or a completion) can claim the terminal state, with any subsequent signals being correctly handled or dropped.