Browse Source

ZOOKEEPER-2687: Deadlock while shutting down the Leader server

Leader server enters into deadlock while shutting down itself. Shutdown of the leader server is called from the synchronized block which must be called from outside the synchronized block. For detail pls refer ZOOKEEPER-2380

Author: Mohammad Arshad <arshad@apache.org>

Reviewers: Abraham Fine <afine@apache.org>, Rakesh Radhakrishnan <rakeshr@apache.org>

Closes #176 from arshadmohammad/ZOOKEEPER-2687 and squashes the following commits:

7551f5c [Mohammad Arshad] Fixed Rakesh's comments
1e3ed70 [Mohammad Arshad] ZOOKEEPER-2687:Deadlock while shutting down the Leader server.
Mohammad Arshad 8 năm trước cách đây
mục cha
commit
fd211a5275

+ 3 - 2
src/java/main/org/apache/zookeeper/server/quorum/Leader.java

@@ -590,8 +590,9 @@ public class Leader {
 
                     // check leader running status
                     if (!this.isRunning()) {
-                        shutdown("Unexpected internal error");
-                        return;
+                        // set shutdown flag
+                        shutdownMessage = "Unexpected internal error";
+                        break;
                     }
 
                     if (!tickSkip && !syncedAckSet.hasAllQuorums()) {