-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
A few Mono operators can lead to bad signal combination of onNext+onError #1853
Comments
simonbasle
added
type/bug
A general bug
status/need-triage
and removed
status/need-triage
labels
Aug 19, 2019
simonbasle
added a commit
that referenced
this issue
Aug 21, 2019
This commit slightly changes the behavior of Mono#using so that, in eager mode, the cleanup is applied inside `onNext`. Thus it is applied before the value is passed to downstream (which at this point is no longer in the protected scope of the `sourceSupplier`). This is done to prevent the case where the value would be passed down yet the cleanup throws, resulting in an invalid sequence of onNext then onError signals.
simonbasle
added a commit
that referenced
this issue
Aug 22, 2019
simonbasle
added a commit
that referenced
this issue
Aug 22, 2019
This commit slightly changes the behavior of Mono#using so that, in eager mode, the cleanup is applied inside `onNext`. Thus it is applied before the value is passed to downstream (which at this point is no longer in the protected scope of the `sourceSupplier`). This is done to prevent the case where the value would be passed down yet the cleanup throws, resulting in an invalid sequence of onNext then onError signals.
simonbasle
added a commit
that referenced
this issue
Aug 22, 2019
simonbasle
added a commit
that referenced
this issue
Aug 22, 2019
This commit slightly changes the behavior of Mono#using so that, in eager mode, the cleanup is applied inside `onNext`. Thus it is applied before the value is passed to downstream (which at this point is no longer in the protected scope of the `sourceSupplier`). This is done to prevent the case where the value would be passed down yet the cleanup throws, resulting in an invalid sequence of onNext then onError signals.
simonbasle
added a commit
that referenced
this issue
Aug 22, 2019
This means that the handler is invoked during processing of the `onNext` signal. Relates-to: #1853
simonbasle
added a commit
that referenced
this issue
Aug 27, 2019
This commit slightly changes the behavior of Mono#using so that, in eager mode, the cleanup is applied inside `onNext`. Thus it is applied before the value is passed to downstream (which at this point is no longer in the protected scope of the `sourceSupplier`). This is done to prevent the case where the value would be passed down yet the cleanup throws, resulting in an invalid sequence of onNext then onError signals.
simonbasle
added a commit
that referenced
this issue
Aug 27, 2019
This means that the handler is invoked during processing of the `onNext` signal. This commit also slightly rework MonoPeekTerminal to make the onSuccess and onError handlers canonical, instead of the (successOrError) one. Finally, it makes `doOnError` directly use MonoPeekTerminal instead of MonoPeek, and modifies the marble diagrams (adding a convention for the null value / empty set). Relates-to: #1853
simonbasle
added a commit
that referenced
this issue
Aug 27, 2019
This means that the handler is invoked during processing of the `onNext` signal. This commit also slightly rework MonoPeekTerminal to make the onSuccess and onError handlers canonical, instead of the (successOrError) one. Finally, it makes `doOnError` directly use MonoPeekTerminal instead of MonoPeek, and modifies the marble diagrams (adding a convention for the null value / empty set). Relates-to: #1853
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behavior
Mono
authorized sequences of events areonNext
+onComplete
,onComplete
oronError
(also, technically, infinite Monos withonNext
or no signal at all).onNext
should never be followed byonError
.Actual Behavior
Mono.just("foo").doOnTerminate(() -> { throw new IllegalStateException(); })
results in the undesirable signals sequence.Mono.using
with acompleteHandler
that throws similarly produces bad signals.Possible Solution
Mono#doOnComplete
, rework into an alias todoOnSuccessOrError
that ignores both inputs, make it prominent in the javadoc (ie.onNext
is discarded rather than propagated if the callback fails, and thus the callback is executed beforeactual.onNext
rather than between onNext and onComplete)Mono#using
, likeusingWhen
it would delay the emission ofonNext
to until theonComplete
handler has finished.Relates to #1832
The text was updated successfully, but these errors were encountered: