Skip to content

JedisCluster throws Too many Cluster redirections when a master node crash #1120

@wenxuanguan

Description

@wenxuanguan

I have redis cluster with 3 masters and 3 slaves and when ever I run DEBUG SEGFAULT to crash master node, it throws an exception
code snap shot:
public static void main(String[] args) {
TestCluster tr = new TestCluster();
try {
tr.parseCommandLine(args);
}
}

public class TestCluster {
public void parseCommandLine() {
jedisClusterNodes.add(new HostAndPort("10.0.1.21", 6379));
jedisClusterNodes.add(new HostAndPort("10.0.1.141", 6379));
......//add 6 cluster nodes ip and port
testTPS(nums, concurrent);
}

public void testTPS() {
Thread[] threads = new MyThread[concurrent];
JedisCluster[] jc = new JedisCluster[concurrent];
for(int i=0; i<concurrent; i++){
jc[i] = new JedisCluster(jedisClusterNodes);
threads[i] = new MyThread(jc[i], nums, concurrent);
}
for(int i=0; i<concurrent; i++){
threads[i].start();
}
}
public void doSet() {
for(long i=0; i<nums; i++){
String ret = jc.set(key, value);
}
}
class MyThread extends Thread{
public void run(){
doSet();
}
}
}
.......................................................................
Exception throws when the master crashed
Exception in thread "Thread-1" redis.clients.jedis.exceptions.JedisClusterMaxRedirectionsException: Too many Cluster redirections?
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:34)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:68)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:85)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:68)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:85)
at redis.clients.jedis.JedisClusterCommand.runWithRetries(JedisClusterCommand.java:68)
at redis.clients.jedis.JedisClusterCommand.run(JedisClusterCommand.java:29)
at redis.clients.jedis.JedisCluster.set(JedisCluster.java:96)
at TestCluster.doSet(TestCluster.java:84)
at TestCluster$MyThread.run(TestCluster.java:114)
.............................................................................
after master node crashed, the slave node failover it.
the same thing happened with JedisCluster.get()
test env:
Jedis 2.7.3
redis 3.0.3

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions