Search code examples
javaspring-bootredisredis-clusterredisson

Can redisson java client detect a restart of a failed master-replica pair in a cluster topology?


My Spring boot application uses redisson 3.3.0 to gain access to a redis cluster topology with the following YML configuration:

redis:
   cluster:
       nodes: ${CLUSTER_HOST}:6379
       read-mode: 'MASTER'
   connections: 125
   max_wait_millis: 10000
   cluster-scan-interval: 1000

The redis cluster is set to default (3 nodes with 1 replica per node).

I stop the 2 nodes containing the same slots (master-replica pair). Then when my application tries to read keys form those slots, as expected I get this exception:

org.redisson.client.RedisConnectionException: 
MasterConnectionPool no available Redis entries.  
Disconnected hosts: [/${CLUSTER_HOST}:6379] 

I suppose this is correct because after checking my redis nodes using CLUSTER NODES command, I can see that the 2 nodes are down and their slots are missing from the cluster.

Thing is, when I start the nodes again I check using CLUSTER INFO & CLUSTER NODES that the cluster is back. Nevertheless, when my application is trying to read again from the cluster, I get this redisson exception:

    io.netty.util.concurrent.DefaultPromise: 151 - An 
    exception was thrown by org.redisson.command.CommandAsyncService$9.operationComplete()
java.lang.NullPointerException: null
    at org.redisson.connection.MasterSlaveConnectionManager.connectionReadOp(MasterSlaveConnectionManager.java:731)
    at org.redisson.command.CommandAsyncService.async(CommandAsyncService.java:501)
    at org.redisson.command.CommandAsyncService.checkAttemptFuture(CommandAsyncService.java:751)
    at org.redisson.command.CommandAsyncService.access$300(CommandAsyncService.java:80)
    at org.redisson.command.CommandAsyncService$9.operationComplete(CommandAsyncService.java:610)
    at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:512)
    at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:505)
    at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:484)
    at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:425)
    at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:122)
    at org.redisson.misc.RedissonPromise.tryFailure(RedissonPromise.java:98)
    at org.redisson.client.protocol.CommandData.tryFailure(CommandData.java:78)
    at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:247)
    at ...

I keep getting that every time my application tries to read or write from/to those specific slots (meaning the specific mater-replica pair), although the redis cluster is OK.

Redisson seems unable to retrieve the correct status for the specific master-replica pair.

Could this be a matter of configuration, or is the default behavior?


Solution

  • This issue was fixed in 3.5.4 version.