io.lettuce.core.RedisCommandTimeoutException: Command timed out after no timeout

本文详细解析了在使用Spring框架整合Redis时出现的超时异常问题,深入探讨了异常产生的根本原因,并提供了一种简单有效的解决方案,即通过调整配置文件中的timeout时间来避免Redis命令超时。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

2019-04-19 15:15:07.928[0;39m [31mERROR[0;39m [35m20456[0;39m [2m—[0;39m [2m[nio-8801-exec-1][0;39m [36mo.a.c.c.C.[.[.[/].[dispatcherServlet] [0;39m [2m:[0;39m Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.QueryTimeoutException: Redis command timed out; nested exception is io.lettuce.core.RedisCommandTimeoutException: Command timed out after no timeout] with root cause

io.lettuce.core.RedisCommandTimeoutException: Command timed out after no timeout
at io.lettuce.core.ExceptionFactory.createTimeoutException(ExceptionFactory.java:51) ~[lettuce-core-5.1.6.RELEASE.jar:na]
at io.lettuce.core.LettuceFutures.awaitOrCancel(LettuceFutures.java:114) ~[lettuce-core-5.1.6.RELEASE.jar:na]
at io.lettuce.core.FutureSyncInvocationHandler.handleInvocation(FutureSyncInvocationHandler.java:69) ~[lettuce-core-5.1.6.RELEASE.jar:na]
at io.lettuce.core.internal.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:80) ~[lettuce-core-5.1.6.RELEASE.jar:na]
at com.sun.proxy.Proxy177.get(UnknownSource) [na:na]atorg.springframework.data.redis.connection.lettuce.LettuceStringCommands.get(LettuceStringCommands.java:66) [spring−data−redis−2.1.6.RELEASE.jar:2.1.6.RELEASE]atorg.springframework.data.redis.connection.DefaultedRedisConnection.get(DefaultedRedisConnection.java:253) [spring−data−redis−2.1.6.RELEASE.jar:2.1.6.RELEASE]atorg.springframework.data.redis.cache.DefaultRedisCacheWriter.lambdaProxy177.get(Unknown Source) ~[na:na] at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.get(LettuceStringCommands.java:66) ~[spring-data-redis-2.1.6.RELEASE.jar:2.1.6.RELEASE] at org.springframework.data.redis.connection.DefaultedRedisConnection.get(DefaultedRedisConnection.java:253) ~[spring-data-redis-2.1.6.RELEASE.jar:2.1.6.RELEASE] at org.springframework.data.redis.cache.DefaultRedisCacheWriter.lambdaProxy177.get(UnknownSource) [na:na]atorg.springframework.data.redis.connection.lettuce.LettuceStringCommands.get(LettuceStringCommands.java:66) [springdataredis2.1.6.RELEASE.jar:2.1.6.RELEASE]atorg.springframework.data.redis.connection.DefaultedRedisConnection.get(DefaultedRedisConnection.java:253) [springdataredis2.1.6.RELEASE.jar:2.1.6.RELEASE]atorg.springframework.data.redis.cache.DefaultRedisCacheWriter.lambdaget1(DefaultRedisCacheWriter.java:109) [spring−data−redis−2.1.6.RELEASE.jar:2.1.6.RELEASE]atorg.springframework.data.redis.cache.DefaultRedisCacheWriter.execute(DefaultRedisCacheWriter.java:242) [spring−data−redis−2.1.6.RELEASE.jar:2.1.6.RELEASE]atorg.springframework.data.redis.cache.DefaultRedisCacheWriter.get(DefaultRedisCacheWriter.java:109) [spring−data−redis−2.1.6.RELEASE.jar:2.1.6.RELEASE]atorg.springframework.data.redis.cache.RedisCache.lookup(RedisCache.java:82) [spring−data−redis−2.1.6.RELEASE.jar:2.1.6.RELEASE]atorg.springframework.cache.support.AbstractValueAdaptingCache.get(AbstractValueAdaptingCache.java:58) [spring−context−5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.cache.interceptor.AbstractCacheInvoker.doGet(AbstractCacheInvoker.java:73) [spring−context−5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.cache.interceptor.CacheAspectSupport.findInCaches(CacheAspectSupport.java:554) [spring−context−5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.cache.interceptor.CacheAspectSupport.findCachedItem(CacheAspectSupport.java:519) [spring−context−5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:401) [spring−context−5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:345) [spring−context−5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61) [spring−context−5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [spring−aop−5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.aop.framework.CglibAopProxy1(DefaultRedisCacheWriter.java:109) ~[spring-data-redis-2.1.6.RELEASE.jar:2.1.6.RELEASE] at org.springframework.data.redis.cache.DefaultRedisCacheWriter.execute(DefaultRedisCacheWriter.java:242) ~[spring-data-redis-2.1.6.RELEASE.jar:2.1.6.RELEASE] at org.springframework.data.redis.cache.DefaultRedisCacheWriter.get(DefaultRedisCacheWriter.java:109) ~[spring-data-redis-2.1.6.RELEASE.jar:2.1.6.RELEASE] at org.springframework.data.redis.cache.RedisCache.lookup(RedisCache.java:82) ~[spring-data-redis-2.1.6.RELEASE.jar:2.1.6.RELEASE] at org.springframework.cache.support.AbstractValueAdaptingCache.get(AbstractValueAdaptingCache.java:58) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.cache.interceptor.AbstractCacheInvoker.doGet(AbstractCacheInvoker.java:73) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.cache.interceptor.CacheAspectSupport.findInCaches(CacheAspectSupport.java:554) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.cache.interceptor.CacheAspectSupport.findCachedItem(CacheAspectSupport.java:519) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:401) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:345) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.aop.framework.CglibAopProxy1(DefaultRedisCacheWriter.java:109) [springdataredis2.1.6.RELEASE.jar:2.1.6.RELEASE]atorg.springframework.data.redis.cache.DefaultRedisCacheWriter.execute(DefaultRedisCacheWriter.java:242) [springdataredis2.1.6.RELEASE.jar:2.1.6.RELEASE]atorg.springframework.data.redis.cache.DefaultRedisCacheWriter.get(DefaultRedisCacheWriter.java:109) [springdataredis2.1.6.RELEASE.jar:2.1.6.RELEASE]atorg.springframework.data.redis.cache.RedisCache.lookup(RedisCache.java:82) [springdataredis2.1.6.RELEASE.jar:2.1.6.RELEASE]atorg.springframework.cache.support.AbstractValueAdaptingCache.get(AbstractValueAdaptingCache.java:58) [springcontext5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.cache.interceptor.AbstractCacheInvoker.doGet(AbstractCacheInvoker.java:73) [springcontext5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.cache.interceptor.CacheAspectSupport.findInCaches(CacheAspectSupport.java:554) [springcontext5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.cache.interceptor.CacheAspectSupport.findCachedItem(CacheAspectSupport.java:519) [springcontext5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:401) [springcontext5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:345) [springcontext5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61) [springcontext5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [springaop5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.aop.framework.CglibAopProxyDynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) ~[spring-aop-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.hong.user.login.service.impl.PersonServiceImplEnhancerBySpringCGLIBEnhancerBySpringCGLIBEnhancerBySpringCGLIBf74ff32f.getPersonByIdCode() ~[classes/:na]
at org.hong.user.login.controller.PersonController.getPersonByIdCode(PersonController.java:26) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_77]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_77]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_77]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_77]
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) ~[spring-core-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.cloud.context.scope.GenericScopeLockedScopedProxyFactoryBean.invoke(GenericScope.java:499) [spring−cloud−context−2.1.1.RELEASE.jar:2.1.1.RELEASE]atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [spring−aop−5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.aop.framework.CglibAopProxyLockedScopedProxyFactoryBean.invoke(GenericScope.java:499) ~[spring-cloud-context-2.1.1.RELEASE.jar:2.1.1.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.aop.framework.CglibAopProxyLockedScopedProxyFactoryBean.invoke(GenericScope.java:499) [springcloudcontext2.1.1.RELEASE.jar:2.1.1.RELEASE]atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [springaop5.1.6.RELEASE.jar:5.1.6.RELEASE]atorg.springframework.aop.framework.CglibAopProxyDynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) ~[spring-aop-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.hong.user.login.controller.PersonControllerEnhancerBySpringCGLIBEnhancerBySpringCGLIBEnhancerBySpringCGLIBd11c7e5b.getPersonByIdCode() ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_77]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_77]

报以上错误,检查代码时发现,配置文件有问题

在这里插入图片描述
timeout时间调整大一点200以上吧。完美解决

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值