From 003f6f0082163889d9a1d423ad62095cc41a1366 Mon Sep 17 00:00:00 2001 From: randgalt Date: Thu, 2 Apr 2020 08:16:41 -0500 Subject: [PATCH] CURATOR-525 - instead of resetting the connection, change the state to RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad hack and needs to be addressed in the future. --- .../framework/state/ConnectionStateManager.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java index 32ddb78966..9ee09b0f4f 100644 --- a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java +++ b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java @@ -291,16 +291,9 @@ else if ( sessionExpirationPercent > 0 ) if ( (currentConnectionState == ConnectionState.LOST) && client.getZookeeperClient().isConnected() ) { // CURATOR-525 - there is a race whereby LOST is sometimes set after the connection has been repaired - // this "hack" fixes it by resetting the connection - log.warn("ConnectionState is LOST but isConnected() is true. Resetting connection."); - try - { - client.getZookeeperClient().reset(); - } - catch ( Exception e ) - { - log.error("Could not reset connection after LOST/isConnected mismatch"); - } + // this "hack" fixes it by forcing the state to RECONNECTED + log.warn("ConnectionState is LOST but isConnected() is true. Forcing RECONNECTED."); + addStateChange(ConnectionState.RECONNECTED); } } }