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
We have upgraded spring boot version from 3.0.5 to 3.2.2. After that, we experience a graceful shutdown issue with our predestroy logic that makes Redis calls.
The new spring version changes the order of destruction for RedisConnectionFactory , they are destroyed earlier than dependent services.
2024-02-09 14:59:16,243 - WARN - CommonAnnotationBeanPostProcessor - Destroy method on bean with name 'redisEarlyClosedDependencyIssueService' threw an exception java.lang.IllegalStateException: LettuceConnectionFactory has been STOPPED. Use start() to initialize it
Thanks for the report but this is out of Spring Boot's control. LettuceConnectionFactorynow implements SmartLifecycle which results in it being closed before your RedisEarlyClosedDependencyIssueService. I'm not sure if the Spring Data Redis team expected Framework to destroy RedisEarlyClosedDependencyIssueService early due to its RedisConnectionFactory dependency or for users of the connection factory to also participate in the lifecycle.
@wilkinsona Thank you very much, I looked into the links that you mentioned, but I could not find any solution to support the old behavior spring bean lifecycle. I will open the issue at spring-data-redis repo.
Please be patient, @emindeniz99. The Spring Data team are very busy at the moment and I was hoping for some guidance from them before another issue was opened in potentially the wrong repository.
Problem
We have upgraded spring boot version from 3.0.5 to 3.2.2. After that, we experience a graceful shutdown issue with our predestroy logic that makes Redis calls.
The new spring version changes the order of destruction for
RedisConnectionFactory
, they are destroyed earlier than dependent services.2024-02-09 14:59:16,243 - WARN - CommonAnnotationBeanPostProcessor - Destroy method on bean with name 'redisEarlyClosedDependencyIssueService' threw an exception java.lang.IllegalStateException: LettuceConnectionFactory has been STOPPED. Use start() to initialize it
Reproduce
Specs
Spring Boot spring-boot-starter-parent, spring-boot-starter-web, spring-boot-starter-data-redis 3.2.2
Graceful Shutdown Console Output (spring log level: trace)
Related Issues
ThreadPoolTaskExecutor rejecting tasks as soon as the context has been closed can lead to exceptions during web app shutdown spring-framework#32226
The text was updated successfully, but these errors were encountered: