-
Notifications
You must be signed in to change notification settings - Fork 3k
Always start dev services before getting the dev services properties #49396
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
Always start dev services before getting the dev services properties #49396
Conversation
no strong objections, but I'd be a bit concerned that going forward we might have situations in which some code (inadvertently or not) triggers starting of services which aren't actually necessary? That could become a painful UX, and not necessarily propagate the feedback to us. What about throing an exception if the getter is triggered but the state of the services isn't valid? It might be more irky to develop with, but we'd benefit from such guidance during development of extensions, or worst case we'd get actionable bug reports. |
I know what you mean, but I think that's not too much of a concern. In the old model, all dev services would have been started in the augmentation phase. In the new model, all dev services get started as the first step of
Developers of extensions shouldn't be calling the method on |
3d04200
to
ff02682
Compare
thanks Holly - that all makes sense, looks like my mental model of the internals is way out of date :) Still it irks me a bit that an "innocently looking getter" would have such a wild side-effect as e.g. having to wait minutes to start some heavy weight DBs - wondering if that should be made more explicit. |
Yeah, I know what you mean. I wondered about something like a method called |
+1 |
Co-Authored-By: Christian von Atzigen <[email protected]>
ff02682
to
22b9191
Compare
Ok, done! The other disadvantage is that it makes the changeset bigger and changes an interface, but that should be ok. |
core/deployment/src/main/java/io/quarkus/runner/bootstrap/StartupActionImpl.java
Show resolved
Hide resolved
Status for workflow
|
Resolves #49208
This builds on @vonatzigenc's fix, and generalises it. When calling code asks for dev services properties, we should always make sure dev services are started by that point. If nothing asks for those properties, we should start dev services as the first step of the startup sequence.
This does have the ickiness that the getter method has side effects, and it also means it's a bit loosely-defined when dev services start. The alternative was to have calling code explicitly request dev services be started before calling the getter. On balance, I decided that was more risky.
I was surprised that we didn't catch this, since the original code broke a quickstart. I haven't investigated that yet, to see if there's anything we can do, but I did add a couple of tests in the main repo which show the problem.