redis / lettuce

Advanced Java Redis client for thread-safe sync, async, and reactive usage. Supports Cluster, Sentinel, Pipelining, and codecs.
https://lettuce.io
MIT License
5.41k stars 979 forks source link

Lettuce 6.x throws commandTimeoutException #2168

Open shadymohs opened 2 years ago

shadymohs commented 2 years ago

Discussed in https://github.com/lettuce-io/lettuce-core/discussions/2167

Originally posted by **shadymohs** July 28, 2022 Dear Sir/Madam, I used to connect to Redis using spring boot 2.0.5.RELEASE that has dependency for lettuce 5.0.5.RELEASE, and everything was working fine. I upgraded my spring boot to 2.4.13 that has dependency for letttuce 6.0.8.RELEASE. Unfortunatly after upgrade I can't connect to redis anymore due to commandTimeoutException. Redis configuration class is using autocinfiguration for lettuceConnectionFactory from application.properities: spring.redis.host= spring.redis.port= spring.redis.database= spring.redis.timeout=5s then I create redisTemplate bean I created a simple java console project and used different lettuce 6.x to 6.2.0 versions, but unfortunatlly no way to solve the issue. public static void main(String[] args) { RedisClient redisClient = RedisClient.create("redis://server-ip:my-port/0"); // no auth so I didn't add password@ RedisClient.create("redis://password@server-ip:my-port/0"); StatefulRedisConnection connection redisClient.connect(); System.out.println("Connected to Redis"); connection.close(); redisClient.shutdown(); } Please for your kind help and support. Our redis version is standalone 6.0.4, also no auth usage so I don't add password or user name
shadymohs commented 2 years ago

I added code for both sample project using main method and how I configure in spring boot

mp911de commented 2 years ago

If you would like us to spend some time helping you to diagnose the problem, please spend some time describing it and, ideally, providing a minimal sample that reproduces the problem. Having full stack traces/logs would help as well.

fanmuyong commented 1 year ago

org.springframework.dao.QueryTimeoutException: Redis command timed out; nested exception is io.lettuce.core.RedisCommandTimeoutException: Command timed out after 5 second(s) at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:70) at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:41) at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java:44) at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:42) at org.springframework.data.redis.connection.lettuce.LettuceConnection.convertLettuceAccessException(LettuceConnection.java:268) at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.convertLettuceAccessException(LettuceStringCommands.java:799) at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.get(LettuceStringCommands.java:68) at org.springframework.data.redis.connection.DefaultedRedisConnection.get(DefaultedRedisConnection.java:253) at org.springframework.data.redis.connection.DefaultStringRedisConnection.get(DefaultStringRedisConnection.java:377) at org.springframework.data.redis.core.DefaultValueOperations$1.inRedis(DefaultValueOperations.java:57) at org.springframework.data.redis.core.AbstractOperations$ValueDeserializingRedisCallback.doInRedis(AbstractOperations.java:59) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:224) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:184) at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:95) at org.springframework.data.redis.core.DefaultValueOperations.get(DefaultValueOperations.java:53) at org.springframework.data.redis.core.DefaultBoundValueOperations.get(DefaultBoundValueOperations.java:50) at com.boke.common.autoconfigure.cache.SysCacheAspect.around(SysCacheAspect.java:90) at sun.reflect.GeneratedMethodAccessor1830.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) at com.boke.sysserver.service.basic.BasicEnuDictionaryService$$EnhancerBySpringCGLIB$$7980f3c0.queryByCode() at com.boke.sysserver.service.order.OrderInputService.saveRTEESpecialMeal(OrderInputService.java:1149) at com.boke.sysserver.service.order.OrderInputService$$FastClassBySpringCGLIB$$adbffaa8.invoke() at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684) at com.boke.sysserver.service.order.OrderInputService$$EnhancerBySpringCGLIB$$7da303e8.saveRTEESpecialMeal() at com.boke.sysserver.mqListener.RTEEListener.receiveQueueSpecialMeal(RTEEListener.java:33) at sun.reflect.GeneratedMethodAccessor2021.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:171) at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:120) at org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:114) at org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:77) at org.springframework.jms.config.TracingMessagingMessageListenerAdapter.onMessage(TracingJmsListenerEndpointRegistry.java:286) at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:736) at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:696) at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:674) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:318) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:257) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1189) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1179) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1076) at java.lang.Thread.run(Thread.java:748) Caused by: io.lettuce.core.RedisCommandTimeoutException: Command timed out after 5 second(s) at io.lettuce.core.ExceptionFactory.createTimeoutException(ExceptionFactory.java:51) at io.lettuce.core.LettuceFutures.awaitOrCancel(LettuceFutures.java:114) at io.lettuce.core.FutureSyncInvocationHandler.handleInvocation(FutureSyncInvocationHandler.java:69) at io.lettuce.core.internal.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:80) at com.sun.proxy.$Proxy948.get(Unknown Source)

tishun commented 7 months ago

Similarly to #2177 the team would need some minimum sample to work on that