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

Register default configuration smallrye configuration files as resources #44652

Conversation

zakkak
Copy link
Contributor

@zakkak zakkak commented Nov 22, 2024

Relates to #41995

@zakkak zakkak requested a review from radcortez November 22, 2024 15:45
Copy link
Member

@radcortez radcortez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we already generate a class with the configuration from all the resources found in the classpath, so we don't need to include additional resources or even load them.

I've been wanting to disable this for a while, but I have yet to determine the implications in JVM mode, so I guess the right fix for now it is to disable it for native image only.

@zakkak
Copy link
Contributor Author

zakkak commented Nov 22, 2024

Actually, we already generate a class with the configuration from all the resources found in the classpath, so we don't need to include additional resources or even load them.

That's right and we have discussed this in the past.

I've been wanting to disable this for a while, but I have yet to determine the implications in JVM mode, so I guess the right fix for now it is to disable it for native image only.

IIRC last time we discussed about it, it was not clear how to achieve this. Did anything change since then?

@gsmet
Copy link
Member

gsmet commented Nov 22, 2024

but I have yet to determine the implications in JVM mode

What exactly would be different in JVM mode?

Copy link

quarkus-bot bot commented Nov 22, 2024

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 289c24c.

Failing Jobs

Status Name Step Failures Logs Raw logs Build scan
Native Tests - Misc3 Build Failures Logs Raw logs 🔍

Full information is available in the Build summary check run.
You can consult the Develocity build scans.

Failures

⚙️ Native Tests - Misc3 #

- Failing: integration-tests/smallrye-config 

📦 integration-tests/smallrye-config

io.quarkus.it.smallrye.config.SmallRyeConfigIT.mpConfigProperties - History - More details - Source on GitHub

java.lang.AssertionError: 
1 expectation failed.
JSON path value doesn't match.
Expected: 9090
  Actual: 8080

	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)

Flaky tests - Develocity

⚙️ JVM Tests - JDK 17

📦 extensions/panache/hibernate-reactive-rest-data-panache/deployment

io.quarkus.hibernate.reactive.rest.data.panache.deployment.repository.PanacheRepositoryResourcePutMethodTest.shouldUpdateComplexObject - History

  • 1 expectation failed. JSON path name doesn't match. Expected: is "updated collection" Actual: empty collection - java.lang.AssertionError
java.lang.AssertionError: 
1 expectation failed.
JSON path name doesn't match.
Expected: is "updated collection"
  Actual: empty collection

	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)

⚙️ JVM Tests - JDK 21

📦 extensions/micrometer/deployment

io.quarkus.micrometer.deployment.binder.VertxHttpClientMetricsTest.testWebClientMetrics - History

  • event executor terminated - java.util.concurrent.RejectedExecutionException
java.util.concurrent.RejectedExecutionException: event executor terminated
	at io.netty.util.concurrent.SingleThreadEventExecutor.reject(SingleThreadEventExecutor.java:934)
	at io.netty.util.concurrent.SingleThreadEventExecutor.offerTask(SingleThreadEventExecutor.java:353)
	at io.netty.util.concurrent.SingleThreadEventExecutor.addTask(SingleThreadEventExecutor.java:346)
	at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:836)
	at io.netty.util.concurrent.SingleThreadEventExecutor.execute0(SingleThreadEventExecutor.java:827)
	at io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:817)
	at io.vertx.core.impl.EventLoopExecutor.execute(EventLoopExecutor.java:35)

@zakkak
Copy link
Contributor Author

zakkak commented Nov 25, 2024

IIRC last time we discussed about it, it was not clear how to achieve this. Did anything change since then?

@radcortez is https://github.com/quarkusio/quarkus/pull/42140/files#diff-bdd91808c3b03f0afb6c4740ab405828a44c92815f28e0fd2271eab84104be87 still the way to go? Should I rebase #42140 and close this PR?

What exactly would be different in JVM mode?

Not sure what Roberto refers to, but the way I see it expectations are different in JVM-mode, i.e. it might feel alien to require a re-deploy to apply changes when changing the smallrye config.

@radcortez
Copy link
Member

IIRC last time we discussed about it, it was not clear how to achieve this. Did anything change since then?

@radcortez is https://github.com/quarkusio/quarkus/pull/42140/files#diff-bdd91808c3b03f0afb6c4740ab405828a44c92815f28e0fd2271eab84104be87 still the way to go? Should I rebase #42140 and close this PR?

I believe so, but let's discuss this further because we may want to take a bigger stance and do it for JVM mode too.

What exactly would be different in JVM mode?

Not sure what Roberto refers to, but the way I see it expectations are different in JVM-mode, i.e. it might feel alien to require a re-deploy to apply changes when changing the smallrye config.

There is a case (which has always been there), probably a bit of a corner case, and nobody has reported it so far because it only affects native mode.

When we flatten the resources, we lose the ordinality of each source. We use ordinality to determine the value of each configuration property by querying sources using their ordinal. With the flattening, we query the value and record it, but the resulting source will have one ordinal versus multiple ones coming from all the static resources. At first glance, this doesn't seem to be a big issue because the values are recorded following the ordinal lookup during build time.

The problem is that, during runtime, we may have additional sources not present during build time, with ordinals in between the ones that were recorded, which may mess up the final configuration values. As an example:

#ordinal 250
foo.bar=application.properties
#ordinal 100
foo.bar=microprofile-config.properties
foo.baz=microprofile-config.properties

These will be recorded and not discovered as resources during native images. The recorded source is at Integer.MIN_VALUE.

Now consider that a new runtime source is discovered as ordinal=90 and foo.baz=runtime source, foo.baz should be microprofile-config.properties, but it is runtime source because the recorded source is lower than the original.

Changing the recording source to a different ordinal doesn't really help because we are merging multiple ordinals ranging from 100-250 (and even more, depending on user sources), and during runtime, we can have a source that gets in the middle and mess up correct lookups. Ideally, we would need to preserve each config property order to ensure that we don't have this issue. While not hard to do, we have yet more data to store, so I wanted to benchmark before coming out with a final solution.

Dev mode, is also a concern, but I believe it should work out of the box. Regardless, we need to test it properly.

@zakkak
Copy link
Contributor Author

zakkak commented Dec 2, 2024

Closing in favor of #42140

@zakkak zakkak closed this Dec 2, 2024
@quarkus-bot quarkus-bot bot added the triage/invalid This doesn't seem right label Dec 2, 2024
@zakkak zakkak deleted the 2024-11-22-register-default-smallrye-config-files-as-resources branch December 2, 2024 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants