-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Explain why quarkus-smallrye-jwt may need to run in blocking mode #34575
Conversation
7ad7121
to
c75700d
Compare
|
||
In such cases, if the connections are slow, for example, it may take more than 3 seconds to get a response from the key endpoint, the current event loop thread will most likely block. | ||
|
||
To prevent it, set `quarkus.smallrye-jwt.blocking-authentication=true`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AdamBien FYI - it may not be necessary, please check. Quarkus is super fast either way, but smallrye-jwt-reactive
is on the map, just not sure yet when it will happen, but it will eventually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the key retrieval / resolution could be too slow / cause the timeout:
(vertx-blocked-thread-checker) Thread Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 2557 ms, time limit is 2000 ms: io.vertx.core.VertxException: Thread blocked
at [email protected]/java.lang.Thread.sleep(Native Method)
at org.jose4j.http.Get.get(Get.java:111)
at io.smallrye.jwt.auth.principal.AwsAlbKeyResolver.retrieveKey(AwsAlbKeyResolver.java:62)
at io.smallrye.jwt.auth.principal.AwsAlbKeyResolver.resolveKey(AwsAlbKeyResolver.java:49)
at org.jose4j.jwt.consumer.JwtConsumer.processContext(JwtConsumer.java:213)
at org.jose4j.jwt.consumer.JwtConsumer.process(JwtConsumer.java:426)
at io.smallrye.jwt.auth.principal.DefaultJWTTokenParser.parseClaims(DefaultJWTTokenParser.java:157)
at io.smallrye.jwt.auth.principal.DefaultJWTTokenParser.parse(DefaultJWTTokenParser.java:60)
at io.smallrye.jwt.auth.principal.DefaultJWTCallerPrincipalFactory.parse(DefaultJWTCallerPrincipalFactory.java:31)
at io.smallrye.jwt.auth.principal.DefaultJWTParser.parse(DefaultJWTParser.java:71)
at io.smallrye.jwt.auth.principal.DefaultJWTParser_ClientProxy.parse(Unknown Source)
at io.quarkus.smallrye.jwt.runtime.auth.MpJwtValidator.createSecurityIdentity(MpJwtValidator.java:76)
The configuration:
quarkus.smallrye-jwt.blocking-authentication=true
solved the problem.
🙈 The PR is closed and the preview is expired. |
JWT doc updates (sub section about the blocking calls, new properties, minor fixes), follow up to #34564