redis Unexpected end of stream异常

redis Unexpected end of stream异常_第1张图片
图1

jedis提供链接池 使用的是apache common pool的第三方jar包,

在有些监控系统中会报Unexpected end of stream.错误,如上图所示

GenericObjectPool.borrowObject方法是真正从pool中取连接对像的方法。

JedisPoolConfig的设置如下:


redis Unexpected end of stream异常_第2张图片
图2

设置了conf.setTestOnBorrow(true); 在取对象时设置可用性验证,

每次取出来之前都要进行ping操作,即调用 JedisFactory.activateObject方法,如图1所示。

activateObject会等待RedisInputStream.ensureFill方法的返回信息,如果服务redisserver返回值不是正确就会报Unexpected end of stream异常。

但这并不影响客户端的使用,borrowObject方法源代码中


redis Unexpected end of stream异常_第3张图片
图3

while(p == null) 会再次从blockqueue中取,如果在超时时间内未取得再报exception

你可能感兴趣的:(redis Unexpected end of stream异常)