Null pointer exception is thrown when performing action and redis server is down
See original GitHub issueExpected behavior: Redisson Client should throw checked exception or return bool value when operation on RBucket can not be performed because server is down
Actual behavior When single server will be shut down during application work and some operation on RBucket will be performed, then NullPointer exception exception is thrown. Also redisson treats RBucket object as not null one.
An exception was thrown by org.redisson.misc.RedissonPromise$$Lambda$731/0x0000000840e3b040.operationComplete() java.lang.NullPointerException: null at org.redisson.client.RedisConnection.send(RedisConnection.java:169) ~[redisson-3.15.0.jar:3.15.0] at org.redisson.command.RedisExecutor.sendCommand(RedisExecutor.java:622) ~[redisson-3.15.0.jar:3.15.0] at org.redisson.command.RedisExecutor.lambda$execute$2(RedisExecutor.java:151) ~[redisson-3.15.0.jar:3.15.0] at org.redisson.misc.RedissonPromise.lambda$onComplete$0(RedissonPromise.java:187) ~[redisson-3.15.0.jar:3.15.0] at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:578) ~[netty-common-4.1.58.Final.jar:4.1.58.Final] at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:552) ~[netty-common-4.1.58.Final.jar:4.1.58.Final] at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:491) ~[netty-common-4.1.58.Final.jar:4.1.58.Final] at io.netty.util.concurrent.DefaultPromise.addListener(DefaultPromise.java:184) ~[netty-common-4.1.58.Final.jar:4.1.58.Final] at org.redisson.misc.RedissonPromise.onComplete(RedissonPromise.java:181) ~[redisson-3.15.0.jar:3.15.0] at org.redisson.command.RedisExecutor.execute(RedisExecutor.java:139) ~[redisson-3.15.0.jar:3.15.0] at org.redisson.command.CommandAsyncService.async(CommandAsyncService.java:606) ~[redisson-3.15.0.jar:3.15.0] at org.redisson.command.CommandAsyncService.writeAsync(CommandAsyncService.java:591) ~[redisson-3.15.0.jar:3.15.0] at org.redisson.RedissonObject.deleteAsync(RedissonObject.java:202) ~[redisson-3.15.0.jar:3.15.0] at org.redisson.RedissonObject.delete(RedissonObject.java:197) ~[redisson-3.15.0.jar:3.15.0]
Steps to reproduce or test case
- Turn on redis and redisson with single server mode
- Save some value by using RBucket
- Shut down redis server
- Try to save / remove another value by using RedissonClient (by using RBucket)
Redis version 6.2.0
Redisson version 3.15.0
Redisson configuration
- single server
- REDIS_MIN_CONNECTION_POOL_SIZE: 24
- REDIS_MAX_CONNECTION_POOL_SIZE: 64
- REDIS_IDLE_CONNECTION_TIMEOUT=300000
- REDIS_RETRY_ATTEMPTS=0
- REDIS_TIMEOUT=500
- REDIS_CONNECT_TIMEOUT=1000
Setting pingConnectionInterval does not do the work. I think that send method from RedisConnection class is culprit, it does not check whether channel has null value.
public <T, R> ChannelFuture send(CommandData<T, R> data) {
return channel.writeAndFlush(data);
}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:17 (9 by maintainers)
Yeah, I came across identical scenario today. Why o why do you throw NPE?
I didn’t change netty version since 3.15.4 version. Please note it’s not all in single jar package. It doesn’t contain dependencies as redisson-all jar