jedis icon indicating copy to clipboard operation
jedis copied to clipboard

Intermittent connection issue with Redis Sentinel

Open shannonantony opened this issue 3 years ago • 2 comments

My springboot application is running fine for hours. but time to time , I see connection lost exception to sentinel.

There is no network issue.

Expected behavior

Write here what you're expecting ...

Actual behavior

Intermittently, connection is getting lost from springboot app to sentinel

2020-10-30 20:59:34.742 [MasterListener-mymaster-[IP:26379]] [ERROR]: redis.clients.jedis.JedisSentinelPool - Lost connection to Sentinel at IP:26379. Sleeping 5000ms and retrying. redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException: Connection reset at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:202) at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:40) at redis.clients.jedis.Protocol.process(Protocol.java:151) at redis.clients.jedis.Protocol.read(Protocol.java:215) at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340) at redis.clients.jedis.Connection.getRawObjectMultiBulkReply(Connection.java:285) at redis.clients.jedis.JedisPubSub.process(JedisPubSub.java:121) at redis.clients.jedis.JedisPubSub.proceed(JedisPubSub.java:115) at redis.clients.jedis.Jedis.subscribe(Jedis.java:2680) at redis.clients.jedis.JedisSentinelPool$MasterListener.run(JedisSentinelPool.java:291) Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:209) at java.net.SocketInputStream.read(SocketInputStream.java:141) at java.net.SocketInputStream.read(SocketInputStream.java:127) at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:196) ... 9 common frames omitted

Steps to reproduce:

Redis / Jedis Configuration

Jedis version:

Jedis 2.9

Redis version:

Redis 5.0

Java version:

JDK 8

Please help.

thanks

Jay

shannonantony avatar Oct 31 '20 01:10 shannonantony

We see exactly the same behaviour in some of our applications. Has there not been any response to this at all?

steam0 avatar Aug 18 '21 07:08 steam0

I observed the same behavior. I think the reason was that the idle connection was terminated by the server but the Java application doesn't clean up idle connection. So it kept using the expired connection, which resulted in this error. I've tried the solution in https://programmerah.com/solve-the-unexpected-end-of-stream-exception-thrown-by-jedis-536/, but didn't solve the problem. Please help!

xiaoyaozi5566 avatar Jan 07 '22 18:01 xiaoyaozi5566

This issue is marked stale. It will be closed in 30 days if it is not updated.

github-actions[bot] avatar Jan 14 '24 00:01 github-actions[bot]