Skip to content

JedisFactory hides exceptions #2323

@three-old-coders

Description

@three-old-coders

Expected behavior

I got the exception

redis.clients.jedis.exceptions.JedisExhaustedPoolException: Could not get a resource since the pool is exhausted
at redis.clients.jedis.util.Pool.getResource(Pool.java:53)

on first access to the pool using getResource. The underlying problem is missing access rights for the "PING" command, but JedisFactory swallos this error silently and turns it in a pool exhausted

Actual behavior

public boolean validateObject(PooledObject<Jedis> pooledJedis) {
    BinaryJedis jedis = (BinaryJedis)pooledJedis.getObject();

    try {
        HostAndPort hostAndPort = (HostAndPort)this.hostAndPort.get();
        String connectionHost = jedis.getClient().getHost();
        int connectionPort = jedis.getClient().getPort();
        return hostAndPort.getHost().equals(connectionHost) && hostAndPort.getPort() == connectionPort && jedis.isConnected() && jedis.ping().equals("PONG");
    } catch (Exception var6) {
        return false;
    }
}

Jedis version:

3.3.0 + 3.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions