-
Notifications
You must be signed in to change notification settings - Fork 38k
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
spring-webflux filters don't pass CoroutineContext #26977
Comments
Is there any progress on this? |
I can confirm the issue which seems to impact During filter + handler Coroutines use case, the handler should reuse the context defined by the filter and currently, it overrides it with I guess the handler should reuse filter |
See potentially related issue #27522. |
Looks like I have found a way to propagate correctly the abstract class ContextAwareHandlerFunction<T : ServerResponse> : HandlerFunction<T> {
override fun handle(request: ServerRequest): Mono<T> {
return handle(Dispatchers.Unconfined, request)
}
abstract fun handle(context: CoroutineContext, request: ServerRequest): Mono<T>
} More details in this draft commit, feedback welcome. |
Hello @sdeleuze
Do you have any ideas how I can pass MDCContext() to suspended controller function, when MDC was set in CoWebFilter? |
With Spring Boot 3.2 + Spring Framework 6.1, I think that should be the case, if not please create an issue with a minimal reproducer as an attached project or a link to a repository. |
Affects: spring-webflux 5.3.7
I write my filter, pass some parameters to coroutine context via
witchContext
and want to be able use it later in the child coroutines and handlers. The problem is thatCoroutineContext
is lost in filter chain.For example something like this
The text was updated successfully, but these errors were encountered: