Repository: zookeeper
Updated Branches:
  refs/heads/master 15e3f7fcc -> fd211a527


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 <[email protected]>

Reviewers: Abraham Fine <[email protected]>, Rakesh Radhakrishnan 
<[email protected]>

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.


Project: http://git-wip-us.apache.org/repos/asf/zookeeper/repo
Commit: http://git-wip-us.apache.org/repos/asf/zookeeper/commit/fd211a52
Tree: http://git-wip-us.apache.org/repos/asf/zookeeper/tree/fd211a52
Diff: http://git-wip-us.apache.org/repos/asf/zookeeper/diff/fd211a52

Branch: refs/heads/master
Commit: fd211a5275b6231e668268fb9df2820e07f5f33c
Parents: 15e3f7f
Author: Mohammad Arshad <[email protected]>
Authored: Thu Feb 16 03:34:18 2017 +0530
Committer: Rakesh Radhakrishnan <[email protected]>
Committed: Thu Feb 16 03:34:18 2017 +0530

----------------------------------------------------------------------
 src/java/main/org/apache/zookeeper/server/quorum/Leader.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zookeeper/blob/fd211a52/src/java/main/org/apache/zookeeper/server/quorum/Leader.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/quorum/Leader.java 
b/src/java/main/org/apache/zookeeper/server/quorum/Leader.java
index 7663d71..0ef5e2c 100644
--- a/src/java/main/org/apache/zookeeper/server/quorum/Leader.java
+++ b/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()) {

Reply via email to