Skip to content
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

OIDC Client does not use connection-delay property #14959

Closed
bwand opened this issue Feb 10, 2021 · 7 comments · Fixed by #14976
Closed

OIDC Client does not use connection-delay property #14959

bwand opened this issue Feb 10, 2021 · 7 comments · Fixed by #14976
Labels
area/oidc kind/bug Something isn't working
Milestone

Comments

@bwand
Copy link

bwand commented Feb 10, 2021

Describe the bug
When using the OID Client and starting the app without running Keycloak it crashes instantly and does not respect the connection-delay property as the normal OIDC stuff does.

Expected behavior
OIDC Client should wait and retry the connection for the configured connection-delay

Actual behavior
App tries to start and crashes instantly:

Attaching to ingest
ingest           | exec java -Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -XX:+ExitOnOutOfMemoryError -cp . -jar /deployments/app.jar
ingest           | Feb 10, 2021 8:46:01 AM org.jboss.threads
ingest           | INFO: JBoss Threads version %s
ingest           | Feb 10, 2021 8:46:02 AM io.quarkus.oidc.client.runtime.OidcClientRecorder
ingest           | INFO: Connecting to IDP for up to %d times every 2 seconds
ingest           | Feb 10, 2021 8:46:03 AM io.quarkus.runtime.ApplicationLifecycleManager run
ingest           | ERROR: Failed to start application (with profile prod)
ingest           | java.net.ConnectException: Connection refused
ingest           | 	at java.base/sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
ingest           | 	at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:779)
ingest           | 	at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:330)
ingest           | 	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334)
ingest           | 	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:702)
ingest           | 	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
ingest           | 	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
ingest           | 	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
ingest           | 	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
ingest           | 	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
ingest           | 	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
ingest           | 	at java.base/java.lang.Thread.run(Thread.java:834)
ingest           | 
ingest exited with code 1

Startup when Keycloak is already running:

Attaching to ingest
ingest           | exec java -Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -XX:+ExitOnOutOfMemoryError -cp . -jar /deployments/app.jar
ingest           | __  ____  __  _____   ___  __ ____  ______ 
ingest           |  --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ 
ingest           |  -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   
ingest           | --\___\_\____/_/ |_/_/|_/_/|_|\____/___/   
ingest           | 2021-02-10 08:44:58,953 INFO  [io.qua.oid.cli.run.OidcClientRecorder] (main) Connecting to IDP for up to 60 times every 2 seconds
ingest           | 2021-02-10 08:44:59,772 INFO  [io.qua.oid.run.OidcRecorder] (main) Connecting to IDP for up to 60 times every 2 seconds
ingest           | 2021-02-10 08:45:00,558 INFO  [com.im.flo.ing.bou.BuildInfoService] (main) ingest V1.0-SNAPSHOT (build at 2021-02-10T09:30:32+0100, commit: 6424ac65bc03a8ae633148bd051ce44825562dc9/6424ac65bc03a8ae633148bd051ce44825562dc9 at 2021-02-10T09:22:52+0100)
ingest           | 2021-02-10 08:45:00,625 INFO  [io.quarkus] (main) ingest 1.0-SNAPSHOT on JVM (powered by Quarkus 1.11.2.Final) started in 3.857s. Listening on: http://0.0.0.0:8091
ingest           | 2021-02-10 08:45:00,626 INFO  [io.quarkus] (main) Profile prod activated. 
ingest           | 2021-02-10 08:45:00,626 INFO  [io.quarkus] (main) Installed features: [cdi, oidc, oidc-client, oidc-client-filter, rest-client, resteasy, resteasy-jsonb, security, smallrye-context-propagation, smallrye-fault-tolerance, smallrye-health, smallrye-metrics, smallrye-openapi, swagger-ui]

To Reproduce

  1. Create a project using OIDC client.
    2 Add delay properties quarkus.oidc.connection-delay=120S and quarkus.oidc-client.connection-delay=120S
  2. Start App without running Keycloak
  3. App instantly crashes.

Configuration

quarkus.oidc.auth-server-url=http://keycloak:8080/auth/realms/flows
quarkus.oidc.client-id=ingest
quarkus.oidc.credentials.secret=b398b8ee-dcb9-4a55-a1ae-eed6c4332406
quarkus.oidc.connection-delay=120S
quarkus.oidc-client.auth-server-url=${quarkus.oidc.auth-server-url}
quarkus.oidc-client.client-id=${quarkus.oidc.client-id}
quarkus.oidc-client.credentials.secret=${quarkus.oidc.credentials.secret}
quarkus.oidc-client.connection-delay=${quarkus.oidc.connection-delay}

Does not work when I use the 120S and not a placeholder.

Environment (please complete the following information):

  • Output of java -version: openjdk version "11.0.2" 2019-01-15
  • Quarkus version or git rev: 1.11.2-FINAL
@bwand bwand added the kind/bug Something isn't working label Feb 10, 2021
@ghost ghost added the area/oidc label Feb 10, 2021
@ghost
Copy link

ghost commented Feb 10, 2021

/cc @pedroigor, @sberyozkin

@sberyozkin
Copy link
Member

Might be a regression caused by Uni based refactoring (i.e I did not update the exception code properly)

@sberyozkin sberyozkin changed the title OIDC Client does not use connection-delay property and crashes app on startup OIDC Client does not use connection-delay property Feb 10, 2021
@sberyozkin
Copy link
Member

sberyozkin commented Feb 10, 2021

@bwand I've removed crashes on startup from the subject - it simply does not reconnect - as opposed to causing a crash. This property has only been added to facilitate the test setups where KC is a few secs or so behind.
I agree it has to be fixed :-)

@bwand
Copy link
Author

bwand commented Feb 10, 2021

@sberyozkin Ok it does not reconnect which prevents the app from starting. ;-) We are using docker-compose which starts up everything and even when using depends_on (to keycloak) in docker-compose.yaml we always have some apps not started in first shot and need to manually restart them which is a bit annoying.

So it is fine that you agree it has to be fixed.

@sberyozkin
Copy link
Member

Oh I see, it is quarkus-oidc-client which is affected, I thought it was quarkus-oidc hence concluded it may have been a regression.

@bwand
Copy link
Author

bwand commented Feb 10, 2021

Yes it is quarkus-oidc-client and not quarkus-oidc.

steel-judoka added a commit to steel-judoka/quarkus that referenced this issue Feb 10, 2021
@steel-judoka
Copy link
Contributor

@sberyozkin can you have a look? I think my pr solves the issue

steel-judoka added a commit to steel-judoka/quarkus that referenced this issue Feb 11, 2021
@ghost ghost added this to the 1.13 - master milestone Feb 11, 2021
sberyozkin added a commit that referenced this issue Feb 11, 2021
Fixed non-working delay for oidc-client
@gsmet gsmet modified the milestones: 1.13 - master, 1.12.0.Final Feb 16, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Feb 16, 2021
(cherry picked from commit e282fd5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/oidc kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants