diff --git a/redisson/src/main/java/org/redisson/connection/MasterSlaveEntry.java b/redisson/src/main/java/org/redisson/connection/MasterSlaveEntry.java index c9d0563d1..39d535484 100644 --- a/redisson/src/main/java/org/redisson/connection/MasterSlaveEntry.java +++ b/redisson/src/main/java/org/redisson/connection/MasterSlaveEntry.java @@ -438,6 +438,12 @@ public class MasterSlaveEntry { @Override public void operationComplete(Future future) throws Exception { if (!future.isSuccess()) { + if (oldMaster != masterEntry) { + writeConnectionPool.remove(masterEntry); + pubSubConnectionPool.remove(masterEntry); + masterEntry.getClient().shutdownAsync(); + masterEntry = oldMaster; + } log.error("Unable to change master from: " + oldMaster.getClient().getAddr() + " to: " + address, future.cause()); return; }