Google Cloud JedisConnectionException : Failed to connect to any host resolved for DNS name
I’m experiencing an intermittent issue with my application that uses Jedis version 5.0.2 for Redis connectivity. The (random) error I’m encountering is:
Failed to connect to any host resolved for DNS name.
redis.clients.jedis.exceptions.JedisConnectionException: Failed to
connect to any host resolved for DNS name.
at redis.clients.jedis.DefaultJedisSocketFactory.connectToFirstSuccessfulHost(DefaultJedisSocketFactory.java:63)
at redis.clients.jedis.DefaultJedisSocketFactory.createSocket(DefaultJedisSocketFactory.java:87)
at redis.clients.jedis.Connection.connect(Connection.java:195)
at redis.clients.jedis.Connection.initializeFromClientConfig(Connection.java:393)
at redis.clients.jedis.Connection.(Connection.java:68)
at redis.clients.jedis.Jedis.(Jedis.java:220)
at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:170)
at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:571)
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:298)
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:223)
at redis.clients.jedis.util.Pool.getResource(Pool.java:38)
at redis.clients.jedis.JedisPool.getResource(JedisPool.java:378)
My application is deployed on Google Cloud. The issue appeared this past Friday randomly. Redeploying the application seemed to temporarily resolve it, but I want to do my due diligence in case it pops agains. My Jedis Version is 5.0.2.
Our SRE team verified that the DNS name resolves correctly to the Redis instance IPs and also checked firewall rules and VPC settings to ensure that traffic is allowed and correctly routed.
Is this a known issue with Jedis 5.0.2 or related to its DNS handling ? Are there any best practices or configuration settings I might be missing ? Would upgrading to a newer version of Jedis potentially resolve this issue?
Any insights or suggestions would be greatly appreciated !
Read more here: Source link