Request context is not preserved across Kotlin coroutines #45441
Description
Describe the bug
I was working with an @RequestScoped
bean and @ActivateRequestContext
, however, I kept running into errors with the request scope not being active when calling my bean, even though I used @ActivateRequestContext
. It turns out this happens because the request context is lost when passing to a Kotlin coroutine.
I am unsure as to whether you would want this to be supported given the thread-safe nature of RequestScoped. However, micronaut seems to have run into a similar issue and then fixed it (micronaut-projects/micronaut-core#4661). If this behaviour should not be changed, it would be nice to at least have this in the documentation as this took a lot of time to realise/figure out.
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
No response
Output of uname -a
or ver
No response
Output of java -version
No response
Quarkus version or git rev
No response
Build tool (ie. output of mvnw --version
or gradlew --version
)
No response
Additional information
No response