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

Conflict with starting DevServices if used with quarkus-oidc and Java 21 #48

Closed
richardbischof opened this issue Jul 25, 2024 · 10 comments
Assignees
Labels
component/runtime Runtime behavior of dev service kind/question Further information is requested

Comments

@richardbischof
Copy link

richardbischof commented Jul 25, 2024

Describe the bug

If microcks and oidc extensions are installed together, the content of two properties is overwritten
quarkus.oidc.auth-server-url=http://keycloak-j5knf:8080/realms/quarkus
keycloak.url=http://keycloak-j5knf:8080
This breaks the applications dev mode.

Expected behavior

microcks and oidc extensions can be used together.

Actual behavior

No response

How to Reproduce?

Reproducer Repository

Microcks version or git rev

0.2.6

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

quarkus ext add microcks

Additional information

No response

Copy link

👋 @richardbischof

Welcome to the Microcks community! 💖

Thanks and congrats 🎉 for opening your first issue here! Be sure to follow the issue template or please update it accordingly.

📢 If you're using Microcks in your organization, please add your company name to this list. 🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

If you need to know why and how to add yourself to the list, please read the blog post "Join the Microcks Adopters list and Empower the vibrant open source Community 🙌"

Hope you have a great time there!

🌟 ~~~~~~~~~ 🌟

📢 If you like Microcks, please ⭐ star ⭐ our repo to support it!

🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact.

@lbroudoux
Copy link
Member

Hello 👋

I think this is related to the way the DevService container network is actually initialized (see quarkusio/quarkus#39899). Are you using a Quarkus version >= 3.11 ?

Would you share a minimalistic Quarkus project so that I can try reproducing it?

@lbroudoux lbroudoux added kind/question Further information is requested component/runtime Runtime behavior of dev service labels Jul 26, 2024
@richardbischof
Copy link
Author

richardbischof commented Jul 26, 2024

Hi,

yes I'm using quarkus 3.12.3, see here: https://github.com/richardbischof/quarkus-microcks-oidc-reproducer

I tried it with quarkus 3.10.0 also, but the error still exists.

2024-07-26 12:32:25,349 INFO  [tc.tes.6.0] (docker-java-stream--623331358) Starting to pull image
2024-07-26 12:32:25,574 INFO  [tc.tes.6.0] (docker-java-stream--623331358) Pulling image layers:  1 pending,  1 downloaded,  0 extracted, (0 bytes/? MB)
2024-07-26 12:32:25,653 INFO  [tc.tes.6.0] (docker-java-stream--623331358) Pulling image layers:  1 pending,  2 downloaded,  0 extracted, (0 bytes/? MB)
2024-07-26 12:32:25,882 INFO  [tc.tes.6.0] (docker-java-stream--623331358) Pulling image layers:  0 pending,  3 downloaded,  0 extracted, (0 bytes/0 bytes)
2024-07-26 12:32:25,886 INFO  [tc.tes.6.0] (docker-java-stream--623331358) Pulling image layers:  0 pending,  4 downloaded,  0 extracted, (0 bytes/0 bytes)
2024-07-26 12:32:25,895 INFO  [tc.tes.6.0] (docker-java-stream--623331358) Pulling image layers:  0 pending,  4 downloaded,  0 extracted, (0 bytes/0 bytes)
2024-07-26 12:32:31,989 INFO  [io.git.mic.qua.dep.DevServicesMicrocksProcessor] (build-49) The 'default' microcks container is ready on http://localhost:39025
2024-07-26 12:32:44,017 INFO  [io.qua.oid.dep.dev.key.KeycloakDevServicesProcessor] (build-2) Dev Services for Keycloak started.
__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2024-07-26 12:32:44,423 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.default.secondary-artifacts" was provided;2024-07-26 12:32:44,423 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.default.grpc.host" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-07-26 12:32:44,423 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.default.grpc" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-07-26 12:32:44,423 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.default.http" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-07-26 12:32:44,423 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.devservices.microcks.service-name" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-07-26 12:32:44,423 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.default.http.host" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-07-26 12:32:44,423 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.default.grpc.port" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-07-26 12:32:44,423 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.default.http.port" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-07-26 12:32:44,423 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.default.primary-artifacts" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-07-26 12:32:44,785 WARN  [io.qua.oid.com.run.OidcCommonUtils] (vert.x-eventloop-thread-1) OIDC Server is not available:: java.net.UnknownHostException: keycloak-qicpa: nodename nor servname provided, or not known
	at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
	at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:52)
	at java.base/java.net.InetAddress$PlatformResolver.lookupByName(InetAddress.java:1211)
	at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1828)
	at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:1139)
	at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1818)
	at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1688)
	at java.base/java.net.InetAddress.getByName(InetAddress.java:1568)
	at io.netty.util.internal.SocketUtils$8.run(SocketUtils.java:156)
	at io.netty.util.internal.SocketUtils$8.run(SocketUtils.java:153)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:571)
	at io.netty.util.internal.SocketUtils.addressByName(SocketUtils.java:153)
	at io.netty.resolver.DefaultNameResolver.doResolve(DefaultNameResolver.java:41)
	at io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:61)
	at io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:53)
	at io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:55)
	at io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:31)
	at io.netty.resolver.AbstractAddressResolver.resolve(AbstractAddressResolver.java:106)
	at io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:220)
	at io.netty.bootstrap.Bootstrap.doResolveAndConnect(Bootstrap.java:171)
	at io.netty.bootstrap.Bootstrap.connect(Bootstrap.java:148)
	at io.vertx.core.net.impl.ChannelProvider.handleConnect(ChannelProvider.java:152)
	at io.vertx.core.net.impl.ChannelProvider.connect(ChannelProvider.java:103)
	at io.vertx.core.net.impl.ChannelProvider.connect(ChannelProvider.java:89)
	at io.vertx.core.net.impl.NetClientImpl.connectInternal2(NetClientImpl.java:309)
	at io.vertx.core.net.impl.NetClientImpl.lambda$connectInternal2$7(NetClientImpl.java:329)
	at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:1583)


2024-07-26 12:32:44,788 WARN  [io.qua.oid.run.OidcRecorder] (vert.x-eventloop-thread-1) OIDC server is not available at the 'http://keycloak-qicpa:8080/realms/quarkus' URL. Please make sure it is correct. Note it has to end with a realm value if you work with Keycloak, for example: 'https://localhost:8180/auth/realms/quarkus'
2024-07-26 12:32:44,790 WARN  [io.qua.oid.run.OidcRecorder] (vert.x-eventloop-thread-1) Tenant 'Default': 'OIDC Server is not available'. OIDC server is not available yet, an attempt to connect will be made during the first request. Access to resources protected by this tenant may fail if OIDC server will not become available
Microcks DevServices has been initialized
2024-07-26 12:32:44,831 INFO  [io.quarkus] (Quarkus Main Thread) demo 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.10.0) started in 22.422s. Listening on: http://localhost:8080
2024-07-26 12:32:44,832 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2024-07-26 12:32:44,833 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, microcks, oidc, rest, security, smallrye-context-propagation, vertx]

@lbroudoux
Copy link
Member

lbroudoux commented Aug 1, 2024

Thanks for the reproducer. I started looking at it, and I succeeded in reproducing the failure.
I'll probably find some free cycles next week. I'll keep you posted.

@lbroudoux
Copy link
Member

Hey there!

Looks like I succeeded in making it start correctly by applying the same changes for database-related DevServices:

[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------------< org.acme:demo >----------------------------
[INFO] Building demo 1.0.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- quarkus:999-SNAPSHOT:dev (default-cli) @ demo ---
[INFO] Invoking resources:3.3.0:resources (default-resources) @ demo
[INFO] Copying 1 resource
[INFO] Invoking quarkus:999-SNAPSHOT:generate-code (default) @ demo
[INFO] Invoking compiler:3.13.0:compile (default-compile) @ demo
[INFO] Nothing to compile - all classes are up to date.
[INFO] Invoking resources:3.3.0:testResources (default-testResources) @ demo
[INFO] skip non existing resourceDirectory /Users/laurent/Development/github/quarkus-microcks-oidc-reproducer/src/test/resources
[INFO] Invoking quarkus:999-SNAPSHOT:generate-code-tests (default) @ demo
[INFO] Invoking compiler:3.13.0:testCompile (default-testCompile) @ demo
[INFO] Nothing to compile - all classes are up to date.
Listening for transport dt_socket at address: 5005
2024-08-01 17:15:24,304 INFO  [io.git.mic.qua.dep.DevServicesMicrocksProcessor] (build-2) The 'default' microcks container is ready on http://localhost:52771
2024-08-01 17:15:34,676 INFO  [io.qua.oid.dep.dev.key.KeycloakDevServicesProcessor] (build-9) Dev Services for Keycloak started.
__  ____  __  _____   ___  __ ____  ______ 
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ 
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/   
2024-08-01 17:15:35,009 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.default.grpc.host" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-08-01 17:15:35,009 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.default.grpc" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-08-01 17:15:35,009 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.default.http" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-08-01 17:15:35,010 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.default.grpc.port" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-08-01 17:15:35,010 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.devservices.microcks.service-name" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-08-01 17:15:35,010 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.default.http.host" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-08-01 17:15:35,010 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.default.http.port" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2024-08-01 17:15:35,010 WARN  [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.microcks.default.primary-artifacts" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
Microcks DevServices has been initialized
2024-08-01 17:15:35,310 INFO  [io.quarkus] (Quarkus Main Thread) demo 1.0.0-SNAPSHOT on JVM (powered by Quarkus 999-SNAPSHOT) started in 19.467s. Listening on: http://localhost:8080
2024-08-01 17:15:35,312 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2024-08-01 17:15:35,312 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, microcks, oidc, rest, security, smallrye-context-propagation, vertx]
2024-08-01 17:15:43,587 INFO  [io.quarkus] (Shutdown thread) demo stopped in 0.013s

--

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  31.889 s
[INFO] Finished at: 2024-08-01T17:15:44+02:00
[INFO] ------------------------------------------------------------------------

What may I check to be sure it is working as expected? Once validated, I may push my update on Quarkus upstream.

@richardbischof
Copy link
Author

Thank you for your quick response and your work. If I can do anything to support or double check, please let me know! :)

@lbroudoux
Copy link
Member

Aside the DevUI checks (for both Keycloak and Microcks DevServices) is there another way to validate via your app that the fix is working?

@lbroudoux
Copy link
Member

A fix in Quarkus has been submitted here: quarkusio/quarkus#42288

@lbroudoux
Copy link
Member

PR has now been merged. We have to wait for the next Quarkus release. Keeping this open in the mean time.

@lbroudoux
Copy link
Member

Latest 3.13.1 version of Quarkus containing the bugfix resolves the reported issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/runtime Runtime behavior of dev service kind/question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants