-
Notifications
You must be signed in to change notification settings - Fork 38.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
Webflux: webfilter receive canceled Mono after successful request #29720
Comments
This looks quite similar to spring-projects/spring-boot#33300 |
Yes, I have stacktrace:
|
Sorry for the delayed response. Relying on a In this case, the response is probably written to the client but the client may be quicker in closing the connection - meaning we'll get a cancellation signal from the HTTP layer (here, Reactor Netty). Both "complete" and "cancel" signals might race here. Unlike other linked issues, the cancellation signal does not come from the Framework. In this case, we think that the I'm closing this issue as there is nothing actionable from a |
Affects: Spring: 6.0.2 spring-boot: 3.0.0
I have noticed that
spring-webflux
application with endpoint that returnsMono<T>
onWebFilter
invocation sometimes receives already canceledMono
. I was able to notice this behaviour only when controller performs some async operation likeIO
ordelayElement
. Also I was able to reproduce only when controller returnsMono<T>
but notFlux<T>
.I have found issue that express similar problem though it is marked as fixed :
#22952
I have created demo app that help to detect this behaviour:
https://github.com/zygisx/webflux-canceled-mono
Simple WebFilter logs whenever it gets already canceled
Mono
Test that performs many requests to running server (have to start up Demo application before running test). Test shows that all requests from client perspective completed successfully and was not canceled prior.
In production we are using WebFiler to record request metrics, and ±10% of our request falls into this trap, where mono is canceled. This makes us blind whether request was actually canceled by client or its caused by underlying issue in spring-framework ?
The text was updated successfully, but these errors were encountered: