user3359842
user3359842

Reputation: 23

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)

Upvotes: 2

Views: 12208

Answers (3)

Aaditya Raj
Aaditya Raj

Reputation: 1118

The embedded Redis server takes a while to release the port. Adding a 10 seconds sleep at the end of the afterAll methods works for me. I agree it is not a clean solution.

override def afterAll() {
    super.afterAll()
    jedis.close()
    redisCluster.stop()
    TimeUnit.SECONDS.sleep(10)
}

Upvotes: 0

yongfa365
yongfa365

Reputation: 352

redis server has set the timeout

config get timeout

jedisPoolConfig setting setTimeBetweenEvictionRunsMillis is not reasonable

Upvotes: 0

marni
marni

Reputation: 4360

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.

Upvotes: 2

Related Questions