redisson / redisson

Redisson - Easy Redis Java client and Real-Time Data Platform. Valkey compatible. Sync/Async/RxJava/Reactive API. Over 50 Redis or Valkey based Java objects and services: Set, Multimap, SortedSet, Map, List, Queue, Deque, Semaphore, Lock, AtomicLong, Map Reduce, Bloom filter, Spring, Tomcat, Scheduler, JCache API, Hibernate, RPC, local cache...
https://redisson.pro
Apache License 2.0
23.26k stars 5.34k forks source link

Unable to send PING command over channel: L:/127.0.0.1:65454 - R:localhost/127.0.0.1:7000 #3887

Closed mevemula closed 2 years ago

mevemula commented 2 years ago

I have a local redis server (version: 6.2.6), redisson(3.16.0) and after a few mins of application startup, I see errors related to Redis connect timeout in logs: Unable to send PING command over channel: [id: 0x87172b36, L:/127.0.0.1:65454 - R:localhost/127.0.0.1:7000] [java] org.redisson.client.RedisTimeoutException: Command execution timeout for command: (PING), params: [], Redis client: [addr=redis://localhost:7000] [java] at org.redisson.client.RedisConnection.lambda$async$1(RedisConnection.java:219) ~[Redisson-3.16.0.jar:?] [java] at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:672) ~[netty-all-4.1.jar:4.1.48.Final] [java] at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:747) ~[netty-all-4.1.jar:4.1.48.Final] [java] at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:472) ~[netty-all-4.1.jar:4.1.48.Final] [java] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-all-4.1.jar:4.1.48.Final] [java] at java.lang.Thread.run(Thread.java:829) [?:?]

And sometimes during application startup, I see this error (not reproducible):

Caused by: RedisConnectionException: Unable to init enough connections amount! Only 2 of 10 were initialized. Redis server: localhost/127.0.0.1:7000 [java] at ConnectionPool$1.lambda$run$0(ConnectionPool.java:158) [java] at RedissonPromise.lambda$onComplete$0(RedissonPromise.java:183) [java] at DefaultPromise.notifyListener0(DefaultPromise.java:577) [java] at DefaultPromise.notifyListenersNow(DefaultPromise.java:551) [java] at DefaultPromise.notifyListeners(DefaultPromise.java:490) [java] at DefaultPromise.setValue0(DefaultPromise.java:615) [java] at DefaultPromise.setFailure0(DefaultPromise.java:608) [java] at DefaultPromise.tryFailure(DefaultPromise.java:117) [java] at RedissonPromise.tryFailure(RedissonPromise.java:96) [java] at ConnectionPool.promiseFailure(ConnectionPool.java:328) [java] at ConnectionPool.lambda$createConnection$1(ConnectionPool.java:294) [java] at RedissonPromise.lambda$onComplete$0(RedissonPromise.java:183) [java] at DefaultPromise.notifyListener0(DefaultPromise.java:577) [java] at DefaultPromise.notifyListeners0(DefaultPromise.java:570) [java] at DefaultPromise.notifyListenersNow(DefaultPromise.java:549) [java] at DefaultPromise.notifyListeners(DefaultPromise.java:490) [java] at DefaultPromise.setValue0(DefaultPromise.java:615) [java] at DefaultPromise.setFailure0(DefaultPromise.java:608) [java] at DefaultPromise.tryFailure(DefaultPromise.java:117) [java] at RedissonPromise.tryFailure(RedissonPromise.java:96) [java] at RedisClient$2$1.run(RedisClient.java:242) [java] at AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) [java] at SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) [java] at NioEventLoop.run(NioEventLoop.java:500) [java] at SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) [java] at ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [java] at FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [java] at java.base/Thread.run(Thread.java:829) [java] Caused by: RedisTimeoutException: Command execution timeout for command: (PING), params: [], Redis client: [addr=redis://localhost:7000] [java] at RedisConnection.lambda$async$1(RedisConnection.java:219) [java] at HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:672) [java] at HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:747) [java] at HashedWheelTimer$Worker.run(HashedWheelTimer.java:472) [java] ... 2 more

Redisson SingleServer Config: .setConnectionPoolSize(15) .setConnectionMinimumIdleSize(10) .setConnectTimeout(3000) .setRetryAttempts(0) .setTimeout(60) .setIdleConnectionTimeout(5000) .setPingConnectionInterval(3000)

Is this related to pingConnectionInterval settings? Also one other question, is retryAttempts = 1 considered as first attempt?

mrniko commented 2 years ago

Check your network connection.

Is this related to pingConnectionInterval settings?

Yes.

Also one other question, is retryAttempts = 1 considered as first attempt?

Considered as a single attempt.

wcandml commented 2 years ago

set idleConnectionTimeout=pingConnectionInterval

the problem does not reappear。 @mevemula You can try, a temporary solution。