Closed xianwei closed 2 weeks ago
Pipelines are the key to the reconnection, not a bug.
Has it been fixed?
Has it been fixed?
I changed the timeout to 2 seconds and it no longer had the problem, it looks like a network IO issue, and opening the connection pool may also alleviate the problem
Bug Report
My application get io.lettuce.core.RedisCommandTimeoutException almost every day. After Reading Lettuce Reference, After checking code, monitor and s on, I got this:
Current Behavior
Application got io.lettuce.core.RedisCommandTimeoutException irregularly. Unexpeted reconnecting log is output frequently.
Stack trace
```java org.springframework.dao.QueryTimeoutException: Redis command timed out; nested exception is io.lettuce.core.RedisCommandTimeoutException: Command timed out after 1 second(s) at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:70) at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.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.lettuce.LettuceConnection.convertLettuceAccessException(LettuceConnection.java:273) at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.convertLettuceAccessException(LettuceStringCommands.java:799) at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.get(LettuceStringCommands.java:68) at org.springframework.data.redis.connection.DefaultedRedisConnection.get(DefaultedRedisConnection.java:266) at org.springframework.data.redis.core.DefaultValueOperations$1.inRedis(DefaultValueOperations.java:57) at org.springframework.data.redis.core.AbstractOperations$ValueDeserializingRedisCallback.doInRedis(AbstractOperations.java:60) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:228) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:188) at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:96) at org.springframework.data.redis.core.DefaultValueOperations.get(DefaultValueOperations.java:53) ```Lettuce's debug log is configured. It seems like that Lettuce connecting to redis periodically, and then disconnecting immediately; 38912 and 38918 is normal client port, the others is abnormal. The attchment file is the weird logs. log.txt
I inspected jvm, and I got the ConnectionWatchdog objects from memory.
Environment