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 !

2

As per Official Jedis guide :

“When the connection to Redis is lost or closed unexpectedly. Configure failover to handle this exception automatically with Resilience4J and the built-in Jedis failover mechanism. When you connect to a Redis with multiple endpoints,

such as Redis Enterprise Active-Active, it’s recommended to disable the JVM’s DNS cache to load-balance requests across multiple endpoints.

Jedis is a synchronous Java client for Redis. Use Lettuce if you need a more advanced Java client that also supports asynchronous and reactive connections. The sections below explain how to install Jedis and connect your application to a Redis database.”

I also recommend you to check the firewall and VPC settings. if any, open the port there.

ufw allow 6379

As your saying random error, check for network latency spikes, packet loss, or connection timeouts on your GCP during periods of application errors.

As per Dragonfly error-solution: Check Version Compatibility :

Library and Server Versions: Verify compatibility between your Jedis library version and Redis server version. Sometimes, subtle issues arise from version mismatches. Check release notes and upgrade guides for any known issues.

Alternative Clients: If persistent issues occur, consider testing with another Redis client library to see if the problem persists. Alternatives like Lettuce might provide better results depending on your use case.”

Check this Jedis Release info for more details. Also refer to the similar open Github issue1 and issue2 for more information.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật