You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been playing around with the latest Spring Boot Graceful Shutdown feature and discovered that after adding spring-cloud-config-server, as a dependency, my Spring Boot application fails to use configured spring.lifecycle.timeout-per-shutdown-phase property and, instead, it's using the default 30s value for graceful shutdown timeout.
2020-06-18 16:02:59.629 INFO 31481 --- [extShutdownHook] o.s.b.w.e.tomcat.GracefulShutdown : Commencing graceful shutdown. Waiting for active requests to complete
2020-06-18 16:03:29.631 INFO 31481 --- [extShutdownHook] o.s.c.support.DefaultLifecycleProcessor : Failed to shut down 1 bean with phase value 2147483647 within timeout of 30000ms: [webServerGracefulShutdown]
2020-06-18 16:03:29.680 INFO 31481 --- [tomcat-shutdown] o.s.b.w.e.tomcat.GracefulShutdown : Graceful shutdown aborted with one or more requests still active
Configured 8 seconds timeout is visible in /actuator/configprops, but apparently it's not used:
C2020-06-18 15:54:13.934 INFO 30672 --- [extShutdownHook] o.s.b.w.e.tomcat.GracefulShutdown : Commencing graceful shutdown. Waiting for active requests to complete
2020-06-18 15:54:21.937 INFO 30672 --- [extShutdownHook] o.s.c.support.DefaultLifecycleProcessor : Failed to shut down 1 bean with phase value 2147483647 within timeout of 8000ms: [webServerGracefulShutdown]
2020-06-18 15:54:21.983 INFO 30672 --- [tomcat-shutdown] o.s.b.w.e.tomcat.GracefulShutdown : Graceful shutdown aborted with one or more requests still active
The text was updated successfully, but these errors were encountered:
Thanks for the sample. When spring-cloud-config-server is added, it results in Spring Cloud creating a parent context that is configured in such a way that it does not include LifecycleAutoConfiguration. As a result, the parent context uses the default lifecycle processor with the default timeout. When LifecycleAutoConfiguration runs in the child context it backs off as it finds the lifecycle processor in the parent context so the main (child) context ends up creating a default lifecycle processor of its own with the default timeout.
We need to only check the current context for a bean named defaultLifecycleProcessor.
wilkinsona
changed the title
timeout-per-shutdown-phase for graceful shutdown not used with spring-cloud-config-server on classpath
In a context hierarchy, timeout-per-shutdown-phase is only honoured in the root context
Jun 18, 2020
Spring Boot 2.3.1
I've been playing around with the latest Spring Boot Graceful Shutdown feature and discovered that after adding
spring-cloud-config-server
, as a dependency, my Spring Boot application fails to use configuredspring.lifecycle.timeout-per-shutdown-phase
property and, instead, it's using the default 30s value for graceful shutdown timeout.I've prepared a minimal application:
https://github.com/pszemus/graceful-shutdown-demo
that has configured graceful shutdown timeout of 8s: https://github.com/pszemus/graceful-shutdown-demo/blob/master/src/main/resources/application.yml#L5
After requesting the long lasting endpoint
/greeting
and stoping the application it should stop after 8 seconds, but it's stopping after 30 seconds, instead:Configured 8 seconds timeout is visible in
/actuator/configprops
, but apparently it's not used:If one gets rid of
spring-cloud-config-server
from pom.xml: https://github.com/pszemus/graceful-shutdown-demo/blob/master/pom.xml#L22then the application starts using configured 8s timeout:
The text was updated successfully, but these errors were encountered: