这是我的JedisPool配置:
setTestWhileIdle(true);
setMinEvictableIdleTimeMillis(60000);
setTimeBetweenEvictionRunsMillis(30000);
setNumTestsPerEvictionRun(-1);
setMaxTotal(100);
setMaxIdle(50);
setMinIdle(20);
setTestWhileIdle(true);
我正在使用JedisCluster执行redis命令,并且完整的堆栈跟踪如下所示:
Caused by: redis.clients.jedis.exceptions.JedisException: Could not return the resource to the pool
at redis.clients.util.Pool.returnBrokenResourceObject(Pool.java:103)
at redis.clients.jedis.JedisPool.returnBrokenResource(JedisPool.java:239)
at redis.clients.jedis.JedisPool.returnBrokenResource(JedisPool.java:16)
at redis.clients.jedis.Jedis.close(Jedis.java:3407)
at redis.clients.jedis.JedisClusterCommand.releaseConnection(JedisClusterCommand.java:170)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:164)
at redis.clients.jedis.JedisClusterCommand.run(JedisClusterCommand.java:31)
at redis.clients.jedis.JedisCluster.lrange(JedisCluster.java:554)
... 14 more
Caused by: java.lang.IllegalStateException: Invalidated object not currently part of this pool
at org.apache.commons.pool2.impl.GenericObjectPool.invalidateObject(GenericObjectPool.java:640)
at redis.clients.util.Pool.returnBrokenResourceObject(Pool.java:101)
... 22 more
此错误有时在生产环境中发生,我只能重新启动服务以解决此问题。有谁知道如何解决这个问题?