Do Quarkus security components and filters run on virtual threads with @RunOnVirtualThread-marked route resources?
#48263
-
Context
ObservationsEverything seems to be running on virtual threads in my application (stripped down version at https://github.com/lloydmeta/quarkus-vthread-pre-routes), including the security-related components. For example, I've logged the thread names in my custom authentication mechanism, identity provider, and request/response filters. The logs consistently show the As shown above, my custom ResearchI looked through some Quarkus PRs, documentation and guides but didn't find an explicit confirmation about the thread context for security components under virtual threads. The official Virtual Threads guide explains how Given that I'm using Quarkus REST (FKA RESTEasy reactive), I expect that virtual thread offloading should apply (IIUC the classic RESTEasy stack doesn't fully support virtual threads). The fact that my logs show these components running on QuestionIs the observed behavior expected? In other words, when using If so, are there any caveats or best practices I should be aware of to ensure this always holds true? For example:
I appreciate any clarification. I want to make sure I'm doing this correctly and not missing a subtle detail about how Quarkus handles virtual threads in the security/filter pipeline. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
|
/cc @cescoffier (virtual-threads), @ozangunalp (virtual-threads), @sberyozkin (security) |
Beta Was this translation helpful? Give feedback.
-
|
@lloydmeta It does look like that the Vert.x handler which manages the offloading to the virtual thread is running early, before various Quarkus HTTP aware components run, such as Quarkus security ones, or JAX-RS filters. I think it makes sense, perhaps you can try to execute a blocking operation in the custom |
Beta Was this translation helpful? Give feedback.
@lloydmeta It does look like that the Vert.x handler which manages the offloading to the virtual thread is running early, before various Quarkus HTTP aware components run, such as Quarkus security ones, or JAX-RS filters.
I think it makes sense, perhaps you can try to execute a blocking operation in the custom
IdentityProvideron the current virtual thread, without using the provided authentication context which is typically used for executing blocking operations