Redis Connection Factory Earlier Graceful Shutdown after Spring 3.2 Upgrade - LettuceConnectionFactory SmartLifecycle Backward Compatibility #2843
Labels
status: feedback-provided
Feedback has been provided
Hi, I have opened the issue to spring-boot, spring-projects/spring-boot#39501, They pointed me to this repository.
I looked into the related commits and pull requests, but I could not find any solution to support the old behavior spring bean lifecycle.
#2503
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
Thanks
The text was updated successfully, but these errors were encountered: