-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Health check on io.quarkus.agroal.runtime.UnconfiguredDataSource always reports healthy #36666
Comments
Thanks for reporting. I'm not sure how we could solve this since an IMO this whole |
I'm all for removing this I can provide a PR if you'd like. |
That would be appreciated, but I can't guarantee it will get merged since the git history suggests this was needed for Dev Services. Maybe the best way to find out would be for you to send a PR removing |
Ideally, a draft PR to avoid overloading our CI and have it run in a fork. I will make the PR a draft one. |
So that we'll be able to postpone initialization to first access in some cases, instead of doing it on startup. This could be useful in particular for deactivated datasources: we don't want to initialize those on startup, but we do want them to fail on first use. An alternative would have been to represent deactivated datasources with a custom implementation of AgroalDataSource, like we currently do with UnconfiguredDataSource, but that solution has serious problems, in particular when we "forget" to implement some methods: see quarkusio#36666
So that we'll be able to postpone initialization to first access in some cases, instead of doing it on startup. This could be useful in particular for deactivated datasources: we don't want to initialize those on startup, but we do want them to fail on first use. An alternative would have been to represent deactivated datasources with a custom implementation of AgroalDataSource, like we currently do with UnconfiguredDataSource, but that solution has serious problems, in particular when we "forget" to implement some methods: see quarkusio#36666
So that we'll be able to postpone initialization to first access in some cases, instead of doing it on startup. This could be useful in particular for deactivated datasources: we don't want to initialize those on startup, but we do want them to fail on first use. An alternative would have been to represent deactivated datasources with a custom implementation of AgroalDataSource, like we currently do with UnconfiguredDataSource, but that solution has serious problems, in particular when we "forget" to implement some methods: see quarkusio#36666
So that we'll be able to postpone initialization to first access in some cases, instead of doing it on startup. This could be useful in particular for deactivated datasources: we don't want to initialize those on startup, but we do want them to fail on first use. An alternative would have been to represent deactivated datasources with a custom implementation of AgroalDataSource, like we currently do with UnconfiguredDataSource, but that solution has serious problems, in particular when we "forget" to implement some methods: see quarkusio#36666
See https://groups.google.com/g/quarkus-dev/c/enMgpOrb61o/m/cRKwiWmGAgAJ for the discussion to change the current behavior of allowing a datasource to be "unconfigured". |
So that we'll be able to postpone initialization to first access in some cases, instead of doing it on startup. This could be useful in particular for deactivated datasources: we don't want to initialize those on startup, but we do want them to fail on first use. An alternative would have been to represent deactivated datasources with a custom implementation of AgroalDataSource, like we currently do with UnconfiguredDataSource, but that solution has serious problems, in particular when we "forget" to implement some methods: see quarkusio#36666
So that we'll be able to postpone initialization to first access in some cases, instead of doing it on startup. This could be useful in particular for deactivated datasources: we don't want to initialize those on startup, but we do want them to fail on first use. An alternative would have been to represent deactivated datasources with a custom implementation of AgroalDataSource, like we currently do with UnconfiguredDataSource, but that solution has serious problems, in particular when we "forget" to implement some methods: see quarkusio#36666
So that we'll be able to postpone initialization to first access in some cases, instead of doing it on startup. This could be useful in particular for deactivated datasources: we don't want to initialize those on startup, but we do want them to fail on first use. An alternative would have been to represent deactivated datasources with a custom implementation of AgroalDataSource, like we currently do with UnconfiguredDataSource, but that solution has serious problems, in particular when we "forget" to implement some methods: see quarkusio#36666
Outcome of that conversation, for future reference:
Here are hints regarding how to detect static injection:
|
Opened #41466 to try to generalize the solution. |
Describe the bug
An application using only agroal extension can start even if no datasource has been configured.
This is because https://github.com/quarkusio/quarkus/blob/main/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSources.java#L147C9-L153C1
An the same application healthCheck wil lreport healthy as UnconfiguredDatasource doesn't overwrite AgroalDatasource.isHealthy which defaults to true.
That means the error is only discovered once someone tries to use the datasource, which is far too late.
Expected behavior
I would expect the application not to start or at least report as not ready.
Actual behavior
The application runs without any errors.
How to Reproduce?
Simply create an application using only agroal datasource (no orm), start (not in dev mode) the application without configuring anything
Output of
uname -a
orver
No response
Output of
java -version
No response
Quarkus version or git rev
main
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
I can provide a MR but I am quite sure what the rigth way would be as even if the behaviour is expected on some cases (as per Datasources comment) it's not always the case.
The text was updated successfully, but these errors were encountered: