Hello,
I am creating a JedisSentinelPool
JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMinIdle(100);
poolConfig.setMaxIdle(150);
poolConfig.setMaxTotal(200);
poolConfig.setBlockWhenExhausted(true);
poolConfig.setTestOnBorrow(true);
JedisSentinelPool pool = new JedisSentinelPool(masterName, sentinels, poolConfig, pasword);
and I am getting a resource from the pool as following from the class Jedis:
public Jedis getJedis() {
try {
Jedis jedis = pool.getJedis();
return jedis;
} catch (Exception ex) {
// Log
}
}
I am using pipelines in my application API to save the request in Redis as a cache. However after some time the active connections on Redis reach the cap (default: 10000) and I get the following exception:
2018-05-12 13:45:34,608 SEVERE [com.apifon.extranet.cache.client.JRedisCache] (default task-9) Exception while retrieving resource from the pool : redis.clients.jedis.exceptions.JedisException: Could not get a resource from the pool
at redis.clients.util.Pool.getResource(Pool.java:51)
at redis.clients.jedis.JedisSentinelPool.getResource(JedisSentinelPool.java:209)
.....
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:49)
In my API I am using the Redis as following:
try (Jedis jedis = JedisManager.getJedis()) {
Pipeline redisPipeline = jedis.pipelined();
redisPipeline.multi();
// Ommited code
for (int i=0; i<10; i++) {
redisPipeline.hset("something".getBytes(), "somethingElse".getBytes(), byteArray);
}
// Ommited code
redisPipeline.exec();
redisPipeline.sync();
}
I have excluded every other part of my application that I am using Redis and I still have the same result. My Jedis version is 2.9, my Java is 1.8.151 and my server is Wildfly 10.0