Caused by: redis.clients.jedis.exceptions.JedisConnectionException: Unknown reply: p
See original GitHub issueorg.springframework.data.redis.RedisConnectionFailureException: Unknown reply: a; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Unknown reply: a
at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:67)
at org.springframework.data.redis.connection.jedis.JedisExceptionConverter.convert(JedisExceptionConverter.java:41)
at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java:44)
at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:42)
at org.springframework.data.redis.connection.jedis.JedisConnection.convertJedisAccessException(JedisConnection.java:181)
at org.springframework.data.redis.connection.jedis.JedisHashCommands.convertJedisAccessException(JedisHashCommands.java:433)
at org.springframework.data.redis.connection.jedis.JedisHashCommands.hGetAll(JedisHashCommands.java:196)
at org.springframework.data.redis.connection.DefaultedRedisConnection.hGetAll(DefaultedRedisConnection.java:862)
at org.springframework.data.redis.core.DefaultHashOperations.lambda$entries$12(DefaultHashOperations.java:231)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:224)
at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:184)
at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:95)
at org.springframework.data.redis.core.DefaultHashOperations.entries(DefaultHashOperations.java:231)
at com.nec.edgedisplay.common.doatier.redis.services.impl.DemographicRedisServiceImpl.findAll(DemographicRedisServiceImpl.java:88)
at com.nec.edgedisplay.common.doatier.redis.services.impl.DemographicRedisServiceImpl$$FastClassBySpringCGLIB$$5cda2f2d.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
at com.nec.edgedisplay.common.doatier.redis.services.impl.DemographicRedisServiceImpl$$EnhancerBySpringCGLIB$$25b48e11.findAll(<generated>)
at com.nec.edgedisplay.common.biztier.services.impl.DemographicServiceImpl.sendDataToEventHub(DemographicServiceImpl.java:67)
at com.nec.edgedisplay.da.scheduler.EventHubScheduler.scheduleDemographicCacheTransferToEventHub(EventHubScheduler.java:60)
at sun.reflect.GeneratedMethodAccessor71.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: redis.clients.jedis.exceptions.JedisConnectionException: Unknown reply: a
at redis.clients.jedis.Protocol.process(Protocol.java:164)
at redis.clients.jedis.Protocol.read(Protocol.java:215)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340)
at redis.clients.jedis.Connection.getBinaryMultiBulkReply(Connection.java:276)
at redis.clients.jedis.BinaryJedis.hgetAll(BinaryJedis.java:1028)
at org.springframework.data.redis.connection.jedis.JedisHashCommands.hGetAll(JedisHashCommands.java:194)
... 29 common frames omitted
@Configuration
public class RedisConnector {
private static final Logger LOGGER = LoggerFactory.getLogger(RedisConnector.class);
/** The host name. */
@Value("${spring.redis.host}")
private String hostName;
/** The port. */
@Value("${spring.redis.port}")
private int port;
/**
* Jedis connection factory.
*
* @return the jedis connection factory
*/
@Bean
JedisConnectionFactory jedisConnectionFactory() {
JedisConnectionFactory jedisConnectionFactory = null;
try {
RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration(hostName,
port);
jedisConnectionFactory = new JedisConnectionFactory(redisStandaloneConfiguration);
jedisConnectionFactory.getPoolConfig().setMaxTotal(128);
jedisConnectionFactory.getPoolConfig().setMaxIdle(128);
} catch (RedisConnectionFailureException e) {
LOGGER.error("Connection break with redis " + e.getMessage());
}
return jedisConnectionFactory;
}
/**
* Redis template.
*
* @return the redis template
*/
@Bean
public RedisTemplate<String, Object> redisTemplate() {
final RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
template.setConnectionFactory(jedisConnectionFactory());
template.setValueSerializer(new GenericToStringSerializer<Object>(Object.class));
template.setEnableTransactionSupport(true);
return template;
}
}
-------------------------------------------------------------------------
@Repository
public class CrowdCountRedisServiceImpl implements ICrowdCountRedisService {
private static final Logger LOGGER = LoggerFactory.getLogger(CrowdCountRedisServiceImpl.class);
/** The Constant KEY. */
private static final String KEY = CrowdCount.class.getName();
/** The redis template. */
private RedisTemplate<String, Object> redisTemplate;
/** The hash operations. */
private HashOperations<String, Long, CrowdCount> hashOperations;
/**
* Instantiates a new crowd count redis service impl.
*
* @param redisTemplate the redis template
*/
@Autowired
public CrowdCountRedisServiceImpl(RedisTemplate<String, Object> redisTemplate) {
this.redisTemplate = redisTemplate;
}
/**
* Inits the rest template.
*/
@PostConstruct
private void init(){
hashOperations = redisTemplate.opsForHash();
}
@Override
public void save(CrowdCount crowdCount) {
LOGGER.info("Inside save method of redis for crowd count");
if(crowdCount != null){
hashOperations.put(KEY, crowdCount.getDataStoreId(), crowdCount);
LOGGER.info("CrowdCount object saved in redis is --------- >"+crowdCount.toString());
}
else{
LOGGER.error("CrowdCount object is null");
}
}
@Override
public CrowdCount find(Long id) {
if(id != null){
return hashOperations.get(KEY, id);
}else{
LOGGER.error("Id is missing");
return null;
}
}
/* (non-Javadoc)
* @see
*/
@Override
public Map<Long, CrowdCount> findAll() {
return hashOperations.entries(KEY);
}
@Override
public void update(CrowdCount crowdCount) {
if(crowdCount != null){
hashOperations.put(KEY, crowdCount.getDataStoreId(), crowdCount);
}else{
LOGGER.error("Object to be updated can not be null");
}
}
@Override
public void deleteAll() {
hashOperations.delete(KEY);
}
/* (non-Javadoc)
* @see
*/
@Override
public void deleteById(Long id) {
if(id != null){
hashOperations.delete(KEY, id);
}else{
LOGGER.error("Id can not be null");
}
}
}
So like above service i have multiple services which is interact with redis frequently but after running for few days i end up with above exception so in order resolve the issue ,i have to flush the redis cache and restart the jar which cost lost of data. Configuration:java 8, RedisTemplate with Spring Boot and Jedis 2.9.0 I am really going through hard time to resolve above issue.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7
Top Results From Across the Web
Caused by: redis.clients.jedis.exceptions ... - GitHub
org.springframework.data.redis.RedisConnectionFailureException: Unknown reply: a; nested exception is redis.clients.jedis.exceptions.
Read more >spring - nested exception is redis.clients.jedis ... - Stack Overflow
I've posted answer here: Could not connect to Redis at 10.XX.XX.28:6379: Unknown error - while accessing from Spring Batch or windows ...
Read more >redis.clients.jedis.exceptions.JedisConnectionException
I've been getting strange exceptions from Jedis when using a single client. The Jedis connection pool is set up through redis gorm plugin....
Read more >Unknown reply的一种解析。_不一样的蒋辉的博客
JedisConnectionException :Allsentinelsdown,cannotdeterminewhereis127.0.0.1masterisrunning... Caused by: redis.clients.jedis.exceptions.
Read more >redis.clients.jedis.exceptions.JedisConnectionException
This page shows Java code examples of redis.clients.jedis.exceptions. ... else { throw new JedisConnectionException("Unknown reply: " + (char) b); } }.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Same problem. Jedis version: 3.3.0, redis server: 6.0.4 redis.clients.jedis.exceptions.JedisConnectionException: Unknown reply: H at redis.clients.jedis.Protocol.process(Protocol.java:169) at redis.clients.jedis.Protocol.read(Protocol.java:220) at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:278) at redis.clients.jedis.Connection.getUnflushedObjectMultiBulkReply(Connection.java:240) at redis.clients.jedis.JedisPubSub.process(JedisPubSub.java:123) at redis.clients.jedis.JedisPubSub.proceed(JedisPubSub.java:117) at redis.clients.jedis.Jedis.subscribe(Jedis.java:2816) at it.robii.messageorientedcommunication.redis.RedisPubSubComm.subscribe(RedisPubSubComm.java:83) at it.robii.messageorientedcommunication.Main.testPubSub(Main.java:42) at it.robii.messageorientedcommunication.Main.TestRedis(Main.java:34) at it.robii.messageorientedcommunication.Main.main(Main.java:21)
Ran into a similar issue. Jedis-3.0.0, Redis 5.0.5
Exception trace:
Code in question:
Single threaded application that does this operation is a loop. Unable to reproduce as the Redis endpoint is no longer available.
Even if this is due to network issues - is there a way to gracefully handle these errors in close()?