Hi
Starting with spring boot 3.2.x shutdown of application with tomcat takes now ~ 11 seconds when using SIGTERM.
By default it uses server.shutdown=immediate. When changing to graceful it is faster (~4 seconds).
This behavior started with spring boot 3.2.x Previous versions (3.1.x,3.0.x) have a fast shutdown ~ 3 seconds. 3.1.10 and 3.2.3 use the same tomcat version (10.1.19).
Created minimal example: https://github.com/copa2/spring-long-shutdown
Comment From: copa2
Sorry. Didn't see this before. Duplicate of https://github.com/spring-projects/spring-boot/issues/39735
Comment From: wilkinsona
Thanks, @copa2. I was just about to comment with a link to that issue.
For background, this has changed in Spring Boot 3.2.x is due to some slight changes to how we shut Tomcat down in support of CRaC. We have separated stopping Tomcat (such that it could be restarted) from destroying it (such that it can't be restarted). The delay that you've observed here that can occur in certain circumstances is an unfortunate side-effect of this. Our hope is that it can be addressed in Tomcat. In the meantime, configuring server.address appears to be a reliable workaround.
/cc @markt-asf