-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Runtime defaults config supplied via RunTimeConfigurationDefaultBuildItem
are not overridden on restart during dev mode
#17069
Comments
@stuartwdouglas this initially seems to be caused by:
in Even if I remove the guard, the new defaults still aren't applied properly. |
Also further down in Lines 516 to 531 in c988b9a
specifiedRunTimeDefaultValues and are considered as user supplied value instead of a extension initialized default value.
|
I was not able to reproduce this. I did try with with a 2021-05-20 12:57:40,243 WARN [io.qua.agr.dep.AgroalProcessor] (build-43) The Agroal dependency is present but no JDBC datasources have been defined.
2021-05-20 12:57:40,248 WARN [io.qua.dat.dep.dev.DevServicesDatasourceProcessor] (build-33) Unable to determine a database type for default datasource
2021-05-20 12:57:40,254 INFO [org.jberet] (build-40) JBERET000030: Resolved job file:/Users/radcortez/Code/open-source/quarkiverse-jberet/integration-tests/chunk/target/classes/META-INF/batch-jobs/auctions.xml
__ ____ __ _____ ___ __ ____ ______
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2021-05-20 12:57:41,339 WARN [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.test.runtime.my.prop" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2021-05-20 12:57:41,375 INFO [org.jbe.schedule-executor] (Quarkus Main Thread) JBERET072500: Created JobScheduler: io.quarkiverse.jberet.runtime.QuarkusJobScheduler@3dcf0da0, based on resource: null
quarkus.test.runtime.my.prop=1234
2021-05-20 12:57:41,494 INFO [io.quarkus] (Quarkus Main Thread) quarkus-jberet-integration-tests-chunk 0.0.6-SNAPSHOT on JVM (powered by Quarkus 1.13.2.Final) started in 1.626s. Listening on: http://localhost:8080
2021-05-20 12:57:41,495 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-05-20 12:57:41,495 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [agroal, cdi, jberet, jberet-rest, mutiny, narayana-jta, rest-client, rest-client-jsonb, resteasy, resteasy-jsonb, smallrye-context-propagation]
2021-05-20 12:58:11,680 INFO [io.qua.dep.dev.RuntimeUpdatesProcessor] (vert.x-worker-thread-0) File change detected: /Users/radcortez/Code/open-source/quarkiverse-jberet/integration-tests/chunk/src/main/resources/application.properties
2021-05-20 12:58:11,710 INFO [io.quarkus] (Quarkus Main Thread) quarkus-jberet-integration-tests-chunk stopped in 0.028s
2021-05-20 12:58:11,771 WARN [io.qua.agr.dep.AgroalProcessor] (build-17) The Agroal dependency is present but no JDBC datasources have been defined.
2021-05-20 12:58:11,779 INFO [org.jberet] (build-14) JBERET000030: Resolved job file:/Users/radcortez/Code/open-source/quarkiverse-jberet/integration-tests/chunk/target/classes/META-INF/batch-jobs/auctions.xml
__ ____ __ _____ ___ __ ____ ______
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2021-05-20 12:58:12,074 WARN [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.test.runtime.my.prop" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
quarkus.test.runtime.my.prop=5678
2021-05-20 12:58:12,096 INFO [io.quarkus] (Quarkus Main Thread) quarkus-jberet-integration-tests-chunk 0.0.6-SNAPSHOT on JVM (powered by Quarkus 1.13.2.Final) started in 0.383s. Listening on: http://localhost:8080
2021-05-20 12:58:12,096 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-05-20 12:58:12,097 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [agroal, cdi, jberet, jberet-rest, mutiny, narayana-jta, rest-client, rest-client-jsonb, resteasy, resteasy-jsonb, smallrye-context-propagation]
2021-05-20 12:58:12,097 INFO [io.qua.dep.dev.RuntimeUpdatesProcessor] (vert.x-worker-thread-0) Hot replace total time: 0.419s I added a property Any thoughts? |
Thanks for having a look at it @radcortez . Yes, if you change the value in |
Ok, to make if I understood correctly: You mean, that if a |
Yes, let me clarify further: A configuration key is set to |
Ah you mean you have two |
Yes, but the overriding happening on restart. This is the configuration we have for various dev services e.g a new container port was initiated, so we change the connection string for MongoDB/Redis connection . |
I see. I was now able to reproduce the issue with a regular test case. The generate config class is not reloaded, but a reinit method called again on dev mode. In this particular case, we don't have the proper values to generate the reinit properly, because we only have them on a dev mode reload. @stuartwdouglas, can you help us understand this here, please? :) |
This slows down continuous testing, as the services have to be started and stopped each time. It also doesn't actually work at the moment due to quarkusio#17069
Also makes sure datasources restart if devservices properties are changed. Fixes quarkusio#17069
Also makes sure datasources restart if devservices properties are changed. Fixes quarkusio#17069
Also makes sure datasources restart if devservices properties are changed. Fixes quarkusio#17069
Also makes sure datasources restart if devservices properties are changed. Fixes quarkusio#17069
Also makes sure datasources restart if devservices properties are changed. Fixes quarkusio#17069
Also makes sure datasources restart if devservices properties are changed. Fixes quarkusio#17069
Also makes sure datasources restart if devservices properties are changed. Fixes quarkusio#17069
Also makes sure datasources restart if devservices properties are changed. Fixes quarkusio#17069 Fixes quarkusio#19931
Also makes sure datasources restart if devservices properties are changed. Fixes quarkusio#17069 Fixes quarkusio#19931
Also makes sure datasources restart if devservices properties are changed. Fixes quarkusio#17069 Fixes quarkusio#19931
Also makes sure datasources restart if devservices properties are changed. Fixes quarkusio#17069 Fixes quarkusio#19931
Also makes sure datasources restart if devservices properties are changed. Fixes quarkusio#17069 Fixes quarkusio#19931
Also makes sure datasources restart if devservices properties are changed. Fixes quarkusio#17069 Fixes quarkusio#19931
Describe the bug
An extension author can provide default values via the
RunTimeConfigurationDefaultBuildItem
, this is the case for dev services. In dev mode, the same key can have different values on each restart e.g a new container was spun by testcontainers, taking a new random/different port. The behaviour I am seeing with dev services is that a new restart of the container having a different port does not update the config value and the first supplied value is always cached.Expected behavior
Defaults values supplied via
RunTimeConfigurationDefaultBuildItem
should always be taken into account on each app restart in dev mode and not cache the first value.Actual behavior
The first default value of a config item is cached and subsequent overrides of the values are not taken into account.
This is the case for datasource devservices and mongo devservices. This leads to connection failures.
To Reproduce
The issue can be reproduced with the current quickstarts e.g the mongodb one
Steps to reproduce the behavior:
https://github.com/quarkusio/quarkus-quickstarts/tree/development/mongodb-quickstart
quickstartvim src/main/resources/application.properties
configuration file and add the following entry onlyquarkus.mongodb.devservices.image-name=mongo
while making sure that the connection-string property is commented out or removed.
3. start the quickstart in dev mode with
mvn quarkus:dev
4. visits the
http://localhost:8080/q/dev/io.quarkus.quarkus-vertx-http/config
page and observe the auto-configured connection string.Also observe the output of the
docker ps
command to see the current mongo container mapped port. This should match the port in the config page.5. Open the
vim src/main/resources/application.properties
configuration file and change the image tag tomongo:4.4.5
this will lead to a new container being spin up.quarkus.mongodb.devservices.image-name=mongo:4.4.5
while making sure that the connection-string property is commented out or removed.
6. Observe the logs of the command in (3) and you'll see logs like below
Observing the output from
docker ps
again will show that a new container was started by devservices but the app is using the old container which can be observed in the config page.The text was updated successfully, but these errors were encountered: