Open mrusinak opened 6 months ago
This is an intentional change in Micronaut Framework 4.4.0 to avoid performance degradation due to the blocking of the Netty event loop.
In addition, since Micronaut framework 4.4.0, any Project Reactor blocking operations throw an exception when they are done on an event loop thread. This new behaviour will help you identify the controller’s methods, which you must annotate with @ExecuteOn to avoid performance loss or dead locks in the event loop.
Please watch: https://www.youtube.com/watch?v=W6iztOuulVU
if you are using a ServerFilter annotate the filter method with @ExecuteOn
.
Thanks, but I do think this is still a bit of a bug / unexpected problem - I believe it should be possible to call JwksSignature.verify()
from within nonblocking threads without running into an error like this.
Whether that be a new method, new argument, or change to the existing verify()
so it can be used without a hidden call to resolve JWKS in a blocking fashion
we are working on https://github.com/micronaut-projects/micronaut-security/pull/1693
Expected Behavior
I should be able to use
JwksSignature.verify()
from withinHttpServerFilter.doFilter
This worked in 4.3.7, and started failing on upgrade to 4.4.1
Actual Behaviour
An exception is thrown:
Steps To Reproduce
"io.micronaut:micronaut-http-server-netty"
"io.micronaut.security:micronaut-security-jwt"
HttpServerFilter
, and configure/autowire in aJwksSignature
doFilter
method of the filter, attempt call theverify
method of the signaturePossible? (Kotlin) Workaround:
"org.jetbrains.kotlinx:kotlinx-coroutines-reactor"
verify
(or another method that will trigger fetching of JWKS) inrunBlocking(Dispatchers.IO) { }
Environment Information
No response
Example Application
No response
Version
4.4.1