I am trying to perform rpush operation and encountered the following error:
redis.clients.jedis.exceptions.JedisConnectionException: Unexpected end of stream.
at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:199) ~[jedis-2.9.0.jar:na]
at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:40) ~[jedis-2.9.0.jar:na]
at redis.clients.jedis.Protocol.process(Protocol.java:151) ~[jedis-2.9.0.jar:na]
at redis.clients.jedis.Protocol.read(Protocol.java:215) ~[jedis-2.9.0.jar:na]
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340) ~[jedis-2.9.0.jar:na]
at redis.clients.jedis.Connection.getIntegerReply(Connection.java:265) ~[jedis-2.9.0.jar:na]
at redis.clients.jedis.Jedis.rpush(Jedis.java:865) ~[jedis-2.9.0.jar:na]
at
Any idea to resolve this error?
the cause is that server setting up timeout nonzero, it means after one period connection is disposed or closed. So client takes the connection from pool, but after that time it is invalid!
Solution is: Set timeout on server to 0 or Do not keep pool on client -> GenericObjectPoolConfig.setMaxIdle(0) So each time to connect server, client take a new connection instead old one from pool