-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Application won't stop in case of error at startup time if management.server.port != server.port #14490
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
Comments
We already register an Lines 149 to 151 in 7bf3229
The problem is that this listener isn't called when the I think we may need a Framework change to fix this. Specifically, it would be helpful if |
I've opened SPR-17324. |
Thanks to the changes made for SPR-17324 which are in Framework 5.0.10 snapshots, the provided sample now passes when using Spring Boot 2.0.6 snapshots. |
Great, many thanks ! |
If an exception occurs during the startup of a spring boot application AND if
management.server.port != server.port
, the application won't stop as it should and stays in a "limbo state" : it's not started, but does not stop.This is a problem when for example run in a Kubernetes cluster, as Kubernetes won't detect that the application didn't start and won't try to restart it.
Repro here : https://github.com/snussbaumer/app-wont-stop-repro, just run
mvn spring-boot:run
and see that the app is neither started nor stopped.If you try to
curl localhost:8080/info
you see an exception :java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@49ed99ad has not been refreshed yet
I repro the problem by throwing an exception in the
start
method of aSmartLifeCycle
object, which is really to make it simple to reproduce, but I see the same problem in a more involved case in a spring cloud application (with eureka and an a config server), when it has problems contacting the configuration server at startup (java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:136)
)Below the files from the repro :
application.properties
pom.xml
The text was updated successfully, but these errors were encountered: