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

Change in behavior after SmallRye Config update to 3.5.1 #38052

Closed
rsvoboda opened this issue Jan 5, 2024 · 8 comments
Closed

Change in behavior after SmallRye Config update to 3.5.1 #38052

rsvoboda opened this issue Jan 5, 2024 · 8 comments
Assignees
Labels

Comments

@rsvoboda
Copy link
Member

rsvoboda commented Jan 5, 2024

Describe the bug

We have noticed change in behavior after SmallRye Config update to 3.5.1 in #37794.

We have testing application which is using quarkus.stork.pong-replica.load-balancer=round-robin property which was valid ~Quarkus 2.7, later it was replaced by quarkus.stork.pong.load-balancer.type.

Till now the app worked fine because roun-robin is the default load-balancer type, there was just warning about unrecognized property.

After SmallRye Config update to 3.5.1 there is error when booting the app.

On one side it's good that users are forced to update the config, but on the other hand I miss any information in https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.7 about the changes around config.

Also raising this issue as @radcortez's comment #37794 (comment) indicated he would like to know about the side-effects of this SmallRye Config change.

Stacktrace:

WARN: Unrecognized configuration key "quarkus.stork.pong-replica.load-balancer" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
Configuration validation failed:
	java.util.NoSuchElementException: SRCFG00042: Value does not match the expected map format "<key1>=<value1>;<key2>=<value2>..." (value was "round-robin")
java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
	at io.quarkus.runtime.Application.start(Application.java:101)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:62)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:33)
Caused by: io.quarkus.runtime.configuration.ConfigurationException: Failed to read configuration properties
	at io.quarkus.deployment.steps.RuntimeConfigSetup.deploy(Unknown Source)
	... 13 more
Caused by: io.smallrye.config.ConfigValidationException: Configuration validation failed:
	java.util.NoSuchElementException: SRCFG00042: Value does not match the expected map format "<key1>=<value1>;<key2>=<value2>..." (value was "round-robin")
	at io.smallrye.config.ConfigMappingProvider.mapConfiguration(ConfigMappingProvider.java:73)
	at io.smallrye.config.SmallRyeConfig.<init>(SmallRyeConfig.java:86)
	at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:720)
	at io.quarkus.runtime.generated.Config.readConfig(Unknown Source)
	at io.quarkus.runtime.generated.Config.createRunTimeConfig(Unknown Source)

Expected behavior

Application starts just with warning about unrecognized property

Actual behavior

After SmallRye Config update to 3.5.1 there is error when booting the app.

I think it's connected with @WithParentName usage in https://github.com/quarkusio/quarkus/blob/main/extensions/smallrye-stork/runtime/src/main/java/io/quarkus/stork/StorkLoadBalancerConfiguration.java#L25

How to Reproduce?

quarkus create app app -P io.quarkus::999-SNAPSHOT --extensions=stork,resteasy-reactive
cd app
mvn clean package -Dquarkus.stork.pong-replica.service-discovery.type=consul -Dquarkus.stork.pong-replica.load-balancer=round-robin

Output of uname -a or ver

macOS

Output of java -version

Java 17

Quarkus version or git rev

5fcc268

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

@rsvoboda rsvoboda added the kind/bug Something isn't working label Jan 5, 2024
Copy link

quarkus-bot bot commented Jan 5, 2024

/cc @Ladicek (smallrye), @jmartisk (smallrye), @phillip-kruger (smallrye), @radcortez (smallrye)

@gsmet
Copy link
Member

gsmet commented Jan 5, 2024

I don't think it's a behavior we want. It looks like a bug.

@radcortez
Copy link
Member

I'll have a look.

@radcortez
Copy link
Member

I believe this is working as expected now.

Notice that the property that must be used is quarkus.stork.pong-replica.load-balancer.[param-key], where [param-key] is missing in the declaration. The @WithParentName shortens the Map parameters name, but you still need to add a key to add values into the Map.

The old implementation simply ignored such declarations, so quarkus.stork.pong-replica.load-balancer=round-robin has no effect at all. The new implementation allows you to inline the entire Map content as <key1>=<value1>;<key2>=<value2>, hence the error message.

@radcortez radcortez closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2024
@rsvoboda
Copy link
Member Author

rsvoboda commented Jan 9, 2024

@radcortez I'm OK with the explanation.

I miss few things

@radcortez
Copy link
Member

I've marked the issue as noteworthy now :)

I'm unsure about quarkus.stork.pong-replica.load-balancer. It may have been a valid property some time ago, but currently (even without this PR), it is completely ignored. I was looking for stork properties in 2.7 and couldn't find it. In 2.13, it already uses the new property.

@rsvoboda
Copy link
Member Author

@radcortez
Copy link
Member

Ah, it is a stork namespace configuration. I was looking in our all config list: https://quarkus.io/version/2.7/guides/all-config.

I'll add a note about it then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants