Closed sbaeumlisberger closed 14 hours ago
/cc @pedroigor (oidc), @sberyozkin (oidc)
@sbaeumlisberger Hi, I'm not sure crashes
is a correct term, I'd prefer fails to start
, what else should it do if the connection is blocking for 10 seconds ? It can't just wait indefinitely.
I'm assuming you have already set quarkus.oidc.use-blocking-dns-lookup=true
.
But there is another property, quarkus.oidc.connection-timeout, which, incidentally, is set to 10 secs by default.
Can you please set to it 30 secs etc and that should resolve it
You are right it fails to start. I think the correct way would be to continue starting and attempt the connection when needed (first request). This is already the case for any other connection error.
It's not a option to increase the timeout for us. We do not want the application start to be delayed more than necessary. I will try the dns option, but I do not think that that will solve the problem.
For context: The application is deployed on kubernetes and the OIDC server is not required for the full functionality of the app.
@sbaeumlisberger quarkus.oidc.connection-timeout
is what can help. If it takes 20 secs to start, what difference does it make if, instead of waiting for the OIDC connection to complete, the first request arrives and the OIDC connection is still being established and it will take 15 secs to finish ?
Perhaps, a better option for your case, given that you don't need OIDC immediately, is to use TenantConfigResolver
instead of configuring it in application.properties, it will initiate a connection during the first request when the OIDC server is already available or nearly available.
Or another, similar, option is to disable the discovery and request that JWK keys are resolved at the first request (I can provide mode details, if it can be of interest).
@sbaeumlisberger That said, I can probably do it exactly the same way when Connection IO error is reported, when the connection is retried at the first request... In meantime, the 2 options above for delaying the connection until the 1st request should do it
Thank you for the fast help. I'll try the two options for delaying the connection.
Many thanks for the tips. The solution was a custom TenantResolver
.
I still think the error handling could be improved, but I will close this issue now that we have found a good solution.
@sbaeumlisberger, thanks for the confirmation, let me re-open it though, as this is something I'd like to check, if we can postpone the connection attempt in case of the io.smallrye.mutiny.TimeoutException
, so I need an open tracker to keep a reminder :-)
For example, if it works, then by decreasing a connection timeout to for 2/3 secs, the startup will continue after the timeout
Describe the bug
When the connection to the OIDC server times out on startup the app crashes with the following error:
Expected behavior
The appliaction starts and attempts to connect during the first request. This is already the behaviour for any other connection error.
Actual behavior
No response
How to Reproduce?
Output of
uname -a
orver
No response
Output of
java -version
No response
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response