Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JedisConnectionException: Unexpected end of stream #932

Closed
Climax777 opened this issue Mar 29, 2015 · 11 comments
Closed

JedisConnectionException: Unexpected end of stream #932

Climax777 opened this issue Mar 29, 2015 · 11 comments

Comments

@Climax777
Copy link

Repeatable exception and for the life of me, I cannot find something I'm doing wrong.

redis.clients.jedis.exceptions.JedisConnectionException: Unexpected end of stream.
    at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:198)
    at redis.clients.util.RedisInputStream.read(RedisInputStream.java:180)
    at redis.clients.jedis.Protocol.processBulkReply(Protocol.java:158)
    at redis.clients.jedis.Protocol.process(Protocol.java:132)
    at redis.clients.jedis.Protocol.processMultiBulkReply(Protocol.java:183)
    at redis.clients.jedis.Protocol.process(Protocol.java:134)
    at redis.clients.jedis.Protocol.read(Protocol.java:192)
    at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:282)
    at redis.clients.jedis.Connection.getRawObjectMultiBulkReply(Connection.java:227)
    at redis.clients.jedis.JedisPubSub.process(JedisPubSub.java:108)
    at redis.clients.jedis.JedisPubSub.proceedWithPatterns(JedisPubSub.java:95)
    at redis.clients.jedis.Jedis.psubscribe(Jedis.java:2513)
    at BenchRedisConsumer$BenchRunner.run(BenchRedisConsumer.java:208)
    at java.lang.Thread.run(Thread.java:745)

Running redis version 2.8.19 on Linux 3.16.0-33-generic #44-Ubuntu SMP Thu Mar 12 12:19:35 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Java version:

java version "1.7.0_76"
Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)

Run the redis consumer followed by the producer of the project here: https://github.com/Climax777/message-queue-bench

@Climax777
Copy link
Author

client-output-buffer-limit was the cause. redis-server closed the connections, leading to the exceptions.

@krestor
Copy link

krestor commented Feb 18, 2016

windows版本下的2.6的版本出现相同的错误,配置了client-output-buffer-limit 为不限制,不好使!好其他招没

@marcosnils
Copy link
Contributor

@krestor ?

@hzengzhi
Copy link

it didn't work for me.
here is the config.

client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 0 0 0
client-output-buffer-limit pubsub 0 0 0

@HeartSaVioR
Copy link
Contributor

You should check that there's a chance for Redis closes the connection.

@ghost
Copy link

ghost commented Jul 1, 2016

It did not work for me too. Any other solutions anyone could find?

@marcosnils
Copy link
Contributor

@pavnii do you have a reproducible test case?

@j-pingus
Copy link

On my side I had some similar issue with a complete different cause.

I select database 1 in my code on my JedisConnection and the REDIS is running in a VM.

However when I select 0 the exception warns me about setting configuration like this:

CONFIG SET protected-mode no

or setup an authentication

When I do set the config it solves the issue for both database 0 and 1.

Hope this will help.

@jameBoy
Copy link

jameBoy commented Nov 3, 2016

It did not work for me too. And my config is "client-output-buffer-limit" ,"normal 0 0 0 slave 268435456 67108864 60 pubsub 33554432 8388608 60" . In my case, i use smembers to get a key which have 700w data . So i want to know ,what cause this problem.

@18099538715
Copy link

@jameBoy this can also happen when client’s timeout is smaller than server's timeout

@jagadeesh583
Copy link

Hi i am also facing the same issue.
here is the exception.
[Start of Exception
SEVERE: Lost connection to Sentinel at sentinal server node: portno. Sleeping 5000ms and retrying.
redis.clients.jedis.exceptions.JedisConnectionException: Unexpected end of stream.
at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:199)
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)
End of exception ]

We have three server nodes one is master, slave, and another one is sentinel server node.

i am trying with following code

  `@Value("${redis.sentinel.master}")
private String master;

@Value("${redis.sentinel.host}")
private String host;

@Value("${redis.sentinel.port}")
private String port;

@Value("${redis.sentinel.password}")
private String password;

@Value("${redis.sentinel.poolSize}")
private String poolSize;

@Bean
public JedisConnectionFactory jedisConnectionFactory() {
	JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory(this.redisSentinelConfiguration(),
			this.jedisPoolConfig());
	jedisConnectionFactory.setPassword(password);
	return jedisConnectionFactory;
}

@Bean
public RedisSentinelConfiguration redisSentinelConfiguration() {
	Set<String> hostAndPorts = new HashSet<String>();
	hostAndPorts.add(host + ":" + port);
	RedisSentinelConfiguration redisSentinelConfiguration = new RedisSentinelConfiguration(master, hostAndPorts);
	return redisSentinelConfiguration;
}

**@Bean
public JedisPoolConfig jedisPoolConfig() {
	JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
	jedisPoolConfig.setMaxTotal(Integer.parseInt(poolSize));
	jedisPoolConfig.setMaxIdle(15);
	jedisPoolConfig.setMinIdle(1);
	jedisPoolConfig.setMaxWaitMillis(10000);
	jedisPoolConfig.setTestOnBorrow(true);
	return jedisPoolConfig;
}**`

here is my redis server version and maven dependencies

Redis server v=3.0.3 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=dd7754250dca4ea7
and
<dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-redis</artifactId> <version>1.5.0.RELEASE</version> </dependency> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.9.0</version> </dependency> <dependency> <groupId>org.springframework.session</groupId> <artifactId>spring-session-data-redis</artifactId> <version>1.3.1.RELEASE</version> </dependency>

It seems there is no problem with the timeouts and if you want the configuration files for the master, slave and sentinel nodes. I will update here.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants