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

Command still hasn't been written into connection! Increase nettyThreads and/or retryInterval settings #3972

Closed r13ljj closed 2 years ago

r13ljj commented 2 years ago

We are experiencing the error what seems like network related errors using the 3.13.2 version of redisson.

Caused by: org.redisson.client.RedisTimeoutException: Command still hasn't been written into connection! Increase nettyThreads and/or retryInterval settings. Payload size in bytes: 0. Node source: NodeSource [slot=0, addr=null, redisClient=null, redirect=null, entry=null], connection: RedisConnection@1897737917 [redisClient=[addr=redis://10.0.2.185:6379], channel=[id: 0xcfc764bc, L:/172.xx.xx.xx:36380 - R:/10.0.2.185:6379], currentCommand=CommandData [promise=RedissonPromise [promise=ImmediateEventExecutor$ImmediatePromise@7fdadeee(failure: java.util.concurrent.CancellationException)], command=(GET), params=[[115, 101, 114, 118, 105, 99, 101, 58, 109, 101, ...]], codec=org.redisson.client.codec.ByteArrayCodec]], command: (GET), params: [[115, 101, 114, 118, 105, 99, 101, 58, 109, 101, ...]] after 3 retry attempts
at org.redisson.command.RedisExecutor$2.run(RedisExecutor.java:200)
at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:672)
at io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:747)
at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:472)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
... 1 common frames omitted

config:

nettyThreads: 32
retryInterval: 1.5s

We run code in the docker of rancher, then have been occurred on some pods. so confused am I.

mrniko commented 2 years ago

Did you try to set nettyThreads to 64? Do you use blocking calls in async callbacks of Redisson commands?

r13ljj commented 2 years ago

Did you try to set nettyThreads to 64? Do you use blocking calls in async callbacks of Redisson commands?

pod set up "cpu: 2", it is too many. it have blocking calls, also have async.

mrniko commented 2 years ago

you should avoid to use blocking calls in Redisson async callbacks.

r13ljj commented 2 years ago

you should avoid to use blocking calls in Redisson async callbacks.

i confirm that it is a bug, all error use the connection which is the same one. please fix it @mrniko .

20211123114910 20211123115434 20211123115125

mrniko commented 2 years ago

can you share your config?

r13ljj commented 2 years ago

can you share your config?

i saw history issues about this point, i'll try to set config 'pingConnectionInterval=30000'

SplotyCode commented 2 years ago

We have the same problem. This is does not seem to be related to netty threads at all. Nearly all threads are runnable and we still get this exception some time. If a client is effected it rejects nearly every command.

mrniko commented 2 years ago

@SplotyCode Can you make a memory dump at that moment?

SplotyCode commented 2 years ago

We made one but I am not allowed to open it myself. I was told that there is nothing unusually. If you tell me would you want to see j can ask an administrator

mrniko commented 2 years ago

@SplotyCode

how many connections affected?

fumanix commented 2 years ago

We have the same problem. How to solve? solution ?

ayu-webmaster commented 2 years ago

We are also facing the same problem. Guys any solution on this ?

mrniko commented 2 years ago

@ayu-webmaster

Make sure that you don't use blocking calls in asyn/rx/reactive handlers.

JanCizmar commented 2 years ago

What do you mean by blocking commands? Can you show an example of wrong usage?

mrniko commented 2 years ago

@JanCizmar

Calls which blocks execution thread.