首页 > 数据库 >Caused by: io.lettuce.core.RedisCommandTimeoutException: Command timed out after 10 second(s)

Caused by: io.lettuce.core.RedisCommandTimeoutException: Command timed out after 10 second(s)

时间:2022-11-10 17:47:25浏览次数:51  
标签:RedisCommandTimeoutException core java 10 redis springframework lettuce org

Caused by: io.lettuce.core.RedisCommandTimeoutException: Command timed out after 10 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.$Proxy110.rpop(Unknown Source)
        at org.springframework.data.redis.connection.lettuce.LettuceListCommands.rPop(LettuceListCommands.java:353)
        ... 13 more
org.springframework.dao.QueryTimeoutException: Redis command timed out; nested exception is io.lettuce.core.RedisCommandTimeoutException: Command timed out after 10 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:270)
        at org.springframework.data.redis.connection.lettuce.LettuceListCommands.convertLettuceAccessException(LettuceListCommands.java:490)
        at org.springframework.data.redis.connection.lettuce.LettuceListCommands.rPop(LettuceListCommands.java:355)
        at org.springframework.data.redis.connection.DefaultedRedisConnection.rPop(DefaultedRedisConnection.java:643)
        at org.springframework.data.redis.core.DefaultListOperations$4.inRedis(DefaultListOperations.java:197)
        at org.springframework.data.redis.core.AbstractOperations$ValueDeserializingRedisCallback.doInRedis(AbstractOperations.java:60)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:228)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:188)
        at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:96)
        at org.springframework.data.redis.core.DefaultListOperations.rightPop(DefaultListOperations.java:193)
        at com.ncs.deep.forgery.reptile.untils.RedisUtil.lrightGetRemove(RedisUtil.java:510)
        at com.ncs.deep.forgery.reptile.jsoup.WebSiteJsoupThread.action(WebSiteJsoupThread.java:53)
        at com.ncs.deep.forgery.reptile.threadabstract.RunnableFactory.run(RunnableFactory.java:15)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: io.lettuce.core.RedisCommandTimeoutException: Command timed out after 10 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.$Proxy110.rpop(Unknown Source)
        at org.springframework.data.redis.connection.lettuce.LettuceListCommands.rPop(LettuceListCommands.java:353)
        ... 13 more
org.springframework.dao.QueryTimeoutException: Redis command timed out; nested exception is io.lettuce.core.RedisCommandTimeoutException: Command timed out after 10 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:270)
        at org.springframework.data.redis.connection.lettuce.LettuceListCommands.convertLettuceAccessException(LettuceListCommands.java:490)
        at org.springframework.data.redis.connection.lettuce.LettuceListCommands.rPop(LettuceListCommands.java:355)
        at org.springframework.data.redis.connection.DefaultedRedisConnection.rPop(DefaultedRedisConnection.java:643)
        at org.springframework.data.redis.core.DefaultListOperations$4.inRedis(DefaultListOperations.java:197)
        at org.springframework.data.redis.core.AbstractOperations$ValueDeserializingRedisCallback.doInRedis(AbstractOperations.java:60)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:228)
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:188)
        at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:96)
        at org.springframework.data.redis.core.DefaultListOperations.rightPop(DefaultListOperations.java:193)
        at com.ncs.deep.forgery.reptile.untils.RedisUtil.lrightGetRemove(RedisUtil.java:510)
        at com.ncs.deep.forgery.reptile.jsoup.WebSiteJsoupThread.action(WebSiteJsoupThread.java:53)
        at com.ncs.deep.forgery.reptile.threadabstract.RunnableFactory.run(RunnableFactory.java:15)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: io.lettuce.core.RedisCommandTimeoutException: Command timed out after 10 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.$Proxy110.rpop(Unknown Source)
        at org.springframework.data.redis.connection.lettuce.LettuceListCommands.rPop(LettuceListCommands.java:353)
        ... 13 more

线上Redis突然间出现此问题

 

spring boot2.x版本默认redis连接池为lettuce,而以前的jedis是没有此问题的,

 所以将lettuce换成jredis,因为通过用Wireshark发现jredis默认是发心跳包的,而lettuce是不发心跳包的,所以能保持连接状态,更改如下

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-redis</artifactId>
    <exclusions>
        <exclusion>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
        </exclusion>
        <exclusion>
            <artifactId>lettuce-core</artifactId>
            <groupId>io.lettuce</groupId>
        </exclusion>
    </exclusions>
</dependency>
<!-- jedis客户端 -->
<dependency>
    <groupId>redis.clients</groupId>
    <artifactId>jedis</artifactId>
</dependency>
<!-- spring2.X集成redis所需common-pool2,使用jedis必须依赖它-->
<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-pool2</artifactId>
</dependency>同事

同时yml文件也要进行修改

spring:
  redis:
    port: 6379
    host: 127.0.0.1
    jedis:
      pool:
        max-active: 8 #连接池的最大数据库连接数。设为0表示无限制
        max-wait: -1 #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
        max-idle: 8 #最大空闲数
        min-idle: 0
    #redis 连接超时时间ms
    timeout: 10000
    database: 0
    password:

  

标签:RedisCommandTimeoutException,core,java,10,redis,springframework,lettuce,org
From: https://www.cnblogs.com/it1042290135/p/16877840.html

相关文章

  • 【1110】【未解决】
    864. 获取所有钥匙的最短路径困难给定一个二维网格 grid ,其中:'.' 代表一个空房间'#' 代表一堵'@' 是起点小写字母代表钥匙大写字母代表锁我......
  • SBT30100VCT-ASEMI肖特基二极管SBT30100VCT
    编辑-ZSBT30100VCT在TO-220AB封装里采用的2个芯片,其尺寸都是94MIL,是一款超低压降低功耗肖特基二极管。SBT30100VCT的浪涌电流Ifsm为250A,漏电流(Ir)为8uA,其工作时耐温度范围......
  • ASEMI肖特基二极管SBT10100VCT参数,SBT10100VCT应用
    编辑-ZASEMI肖特基二极管SBT10100VCT参数:型号:SBT10100VCT最大重复峰值反向电压(VRRM):100V最大平均正向整流输出电流(IF):10A峰值正向浪涌电流(IFSM):150A每个元件的典型热阻(ReJA):2℃/......
  • 2022-11-10 js 删除字符串某个值
    共4种方案:letstr='123';1、replace('1','一');//结果:一23 解释:把指定字符串替换成你想要的字符串,如果替换值为空字符串,则可以实现删除效果符串;不会改变原始字符串......
  • SBT30100VCT-ASEMI肖特基二极管SBT30100VCT
    编辑-ZSBT30100VCT在TO-220AB封装里采用的2个芯片,其尺寸都是94MIL,是一款超低压降低功耗肖特基二极管。SBT30100VCT的浪涌电流Ifsm为250A,漏电流(Ir)为8uA,其工作时耐温度范......
  • ASEMI肖特基二极管SBT10100VCT参数,SBT10100VCT应用
    编辑-ZASEMI肖特基二极管SBT10100VCT参数:型号:SBT10100VCT最大重复峰值反向电压(VRRM):100V最大平均正向整流输出电流(IF):10A峰值正向浪涌电流(IFSM):150A每个元件的典型热阻(R......
  • NETCORE 使用中间件获取请求头
    NETCORE使用中间件获取请求头创建项目:框架net6webapi:项目名称:NETCORE.RequestHead   1. 创建中间件 RequestHeaderVerificationMiddleware.csusingMic......
  • Karmada大规模测试报告发布:突破100倍集群规模
    摘要:在本文中,我们将介绍用于测试的相关指标,如何进行大规模测试,以及我们如何实现大规模的集群接入。本文分享自华为云社区《​​突破100倍集群规模!Karmada大规模测试报告发布......
  • [leetcode每日一题]11.10
    864. 获取所有钥匙的最短路径给定一个二维网格 ​​grid​​ ,其中:'.' 代表一个空房间'#' 代表一堵'@'小写字母代表钥匙大写字母代表锁我们从起点开始出发,一次移动是指......
  • 2022年11月10日 亲测可用Clion永久2022.2最新激活码 破解 账号一年 教育授权学生账号
    【正版授权个人专属】:Jetbrains全系列IDE使用1年只要...【官方授权正版激活】:官方授权正版激活支持Jetbrains家族下所有IDE个人账号...“本教程中激活插件文件......