jedis:JedisSentinelPool 运行一段时间后报could not get resource from pool

DAO 2015-07-27 11:07:16
JedisSentinelPool ,运行一段时间后报could not get resource from pool

环境:

1. jar版本:jedis2.7
2.redis版本:3.0.2
3.sentinel redis主备
4. 通过JedisSentinelPool获取jedis实例



已排除:

1. 最大连接数太小,(设置为-1无限制)
2.没有returnResourceObject (2.5以后说是无需手动return, 但是 return与否都已经尝试都会报错)
3. 局域网不存在网络问题
4....


还未尝试:

1. 设置超时时间 默认为2s ,博文说可以设置为0(永不销毁), 说是初始化的jedis会超时销毁
http://my.oschina.net/u/1188909/blog/262712
2. 重建pool太暴力,暂不考虑
3. ....


感谢各位大神路过
...全文
1016 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
mrtalon 2015-08-29
  • 打赏
  • 举报
回复
怎么解决啊?
X元素 2015-08-04
  • 打赏
  • 举报
回复
你是不是不止一个JedisSentinelPool ,这样会导致返回不同的Jedis实例,在线程不安全的情况下,会发生Could not get a resource from the pool
DAO 2015-07-28
  • 打赏
  • 举报
回复
异常信息如下:
2015-07-27 17:54:00 | RedisUtils.getJedis():
redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
at redis.clients.util.Pool.getResource(Pool.java:50)
at redis.clients.jedis.JedisSentinelPool.getResource(JedisSentinelPool.java:181)
at com.huawei.exam.util.RedisUtils.getJedis(RedisUtils.java:76)
at com.huawei.exam.util.RedisUtils.listLlen(RedisUtils.java:486)
at com.huawei.exam.datacache.RedisCacheDataTimer$4.run(RedisCacheDataTimer.java:126)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Caused by: java.util.NoSuchElementException: Unable to validate object
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:506)
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363)
at redis.clients.util.Pool.getResource(Pool.java:48)
... 6 more

25,985

社区成员

发帖
与我相关
我的任务
社区描述
高性能WEB开发
社区管理员
  • 高性能WEB开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧