-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Hello,
I'm facing an issue on Spring Boot 2.5.4
under the following conditions:
spring-boot-starter-parent:2.5.4
spring-boot-starter-web:2.5.4
spring-kafka:2.7.6
- embedded
Tomcat
won't start becausePort 8080 is already in use
In this scenario an ApplicationFailedEvent
is triggered and main thread
is killed, but the application won't quit because kafka consumers
threads are still alive. This results in a compromised application that appears like is up and running, but it is not.
I have also made a test using legacy spring-boot-starter-parent:2.2.10.RELEASE
and related dependencies. In this scenario the behaviour is different and the Spring boot application quits as expected.
I've published a simple project to reproduce the problem at this link https://github.com/tnormani/application-failed-event-testcase .
Project requires port 8080
to be already bound by something else and a kafka broker
for the consumer connection.
In the project you will find also a ApplicationFailedListener
I created during tests, but it's not referenced in the spring.factories
file to make test case behave as expected.
I've also raised a question on StackOverflow (https://stackoverflow.com/questions/70378200/how-to-make-a-spring-boot-application-quit-on-tomcat-failure) days ago but after the comparison with spring-boot-starter-parent:2.2.10.RELEASE
and some further testing, I thought it would be better if you could have a look at it.
Thanks in advance.