Skip to content

Jedis should not require localhost to be resolved so it can run clean in serverless env #1424

@xoraes

Description

@xoraes

Expected behavior

Jedis should not require localhost to be resolved so it can run clean in serverless env - aws lambda.

Actual behavior

When running jedis on aws lambda, it tries to resolve localhost which is not available in serverless env resulting in a "SEVERE" log output.

Write here what happens instead ...

15:02:45 SEVERE: cant resolve localhost address
15:02:45 java.net.UnknownHostException: ip-10-29-121-116: ip-10-29-121-116: unknown error
15:02:45 at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
15:02:45 at redis.clients.jedis.HostAndPort.getLocalHostQuietly(HostAndPort.java:105)

Steps to reproduce:

Use jedis client in aws lambda to connect to aws redis service endpoint
public class RedisClientDao {

private static JedisPool pool = null;

static {
    String endpoint = Preconditions.checkNotNull((String)Config.get("CACHE_ENDPOINT"));
    JedisPoolConfig poolConfig = new JedisPoolConfig();
    poolConfig.setJmxEnabled(false);
    pool = new JedisPool(poolConfig, endpoint);

}

public static Jedis getRedisClient() {
    return pool.getResource();
}
}

Redis / Jedis Configuration

jedis 2.9.0 running on java 1.8 running on aws lambda connecting to redis 3.2.4

Jedis version:

2.9

Redis version:

3.2.4

Java version:

1.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions