Search code examples
redisjedis

redis.clients.jedis.exceptions.JedisConnectionException: Unexpected end of stream


I am trying to add some data to a Redis server while using a Jedis client and I am getting the following error: Unexpected end of stream error. What could be the reasons for this to happen?

redis.clients.jedis.exceptions.JedisConnectionException: Unexpected end of stream.

[info] at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:198)

[info] at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:40)

[info] at redis.clients.jedis.Protocol.process(Protocol.java:128)

[info] at redis.clients.jedis.Protocol.read(Protocol.java:192)

[info] at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:282)

[info] at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:181)

[info] at redis.clients.jedis.Jedis.watch(Jedis.java:1449)


Solution

  • I had the same exception. In my case the problem was two concurrent threads trying to use Jedis at the same time. Once I made sure that only single thread writes/reads to/from my Jedis client, the problem went away.