background

spring-boot 2.3.9 RELEASE default lettuce 5.3.6 RELEASE redis cluster mode
SpringBoot lettuce infinite print log - Unexpected exception during request: java.lang.NullPointerException

some bean use @PostConstruct and method contain redis action ,This is the key to reproducing the problem。

@Service
@Slf4j
public class TestA   {


    @PostConstruct
    public void init(){
        //redis action
    }

}

expression

log infinite print Unexpected exception during request: java.lang.NullPointerException,as follows: SpringBoot lettuce infinite print log - Unexpected exception during request: java.lang.NullPointerException

print very quickly。

reasons

lettuce 5.3.6 RELEASE has a bug about use trace,the key code ,as follows: SpringBoot lettuce infinite print log - Unexpected exception during request: java.lang.NullPointerException

when use full link tracking related modules, lettuce does not first determine whether it is empty, and this is the reason。

solutions

Either one will do

1)、pom add lettuce new version lettuce fix it later,but in it new version,like 6.1.0.RELEASE,the code as follows: https://github.com/lettuce-io/lettuce-core/blob/main/src/main/java/io/lettuce/core/protocol/CommandHandler.java#L460

SpringBoot lettuce infinite print log - Unexpected exception during request: java.lang.NullPointerException

2)、user code change use @Order or implement ApplicationRunner rather than use @PostConstruct

suggest

spring-boot 2.3.9 release may use new version of lettuce,at least not lettuce 5.3.6 RELEASE 。

Comment From: wilkinsona

Thanks for letting us know. Unfortunately, Spring Boot 2.3.x is already using the latest release in the Lettuce 5.3.x line and we cannot upgrade to 6.x in a 5.3.x maintenance release. Spring Boot 2.4.x has upgraded to Lettuce 6.0.x and Spring Boot 2.5.x will use Lettuce 6.1.x so I don't think there's anything more that we can do here at this time. If there is a Lettuce 5.3.7 release in the future, then we will upgrade in due course.

You may want to make sure that the Lettuce team are aware of the problem in 5.3.x by searching their issue tracker and opening an issue if the problem has not already been reported. If you find an existing issue or open a new one, please comment here with a link to it so that we can follow along.

Comment From: wbzj1110

Thanks for letting us know. Unfortunately, Spring Boot 2.3.x is already using the latest release in the Lettuce 5.3.x line and we cannot upgrade to 6.x in a 5.3.x maintenance release. Spring Boot 2.4.x has upgraded to Lettuce 6.0.x and Spring Boot 2.5.x will use Lettuce 6.1.x so I don't think there's anything more that we can do here at this time. If there is a Lettuce 5.3.7 release in the future, then we will upgrade in due course.

You may want to make sure that the Lettuce team are aware of the problem in 5.3.x by searching their issue tracker and opening an issue if the problem has not already been reported. If you find an existing issue or open a new one, please comment here with a link to it so that we can follow along.

https://github.com/lettuce-io/lettuce-core/discussions/1701 I will fix this issue,and after lettuce have new 5.3.X version。I will comment again 。thks。 After all, the latest spring-boot realse that adapts to spring-cloud is as follows: spring-boot 2.3.9 RELEASE spring-cloud Hoxton.SR10

Comment From: wbzj1110

@wilkinsona hi, lettuce has fixed this bug and relese new 5.3.7 RELEASE version. As follows: https://github.com/lettuce-io/lettuce-core/releases/tag/5.3.7.RELEASE I suggest spring-boot may follow along.

After read PR notes ,I know spring-boot havs a semi-automated process to upgrade dependencies, so looking forward to it soon.

Comment From: snicoll

After read PR notes ,I know spring-boot havs a semi-automated process to upgrade dependencies, so looking forward to it soon.

We do and we will upgrade as usual.

Comment From: wbzj1110

After read PR notes ,I know spring-boot havs a semi-automated process to upgrade dependencies, so looking forward to it soon.

We do and we will upgrade as usual.

OK~~thks