Repository: zookeeper Updated Branches: refs/heads/branch-3.5 081697093 -> f07a836e3
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. (cherry picked from commit fd211a5275b6231e668268fb9df2820e07f5f33c) Signed-off-by: Rakesh Radhakrishnan <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/zookeeper/repo Commit: http://git-wip-us.apache.org/repos/asf/zookeeper/commit/f07a836e Tree: http://git-wip-us.apache.org/repos/asf/zookeeper/tree/f07a836e Diff: http://git-wip-us.apache.org/repos/asf/zookeeper/diff/f07a836e Branch: refs/heads/branch-3.5 Commit: f07a836e3e24e9b643fecf0c0cfca3d7dbc60859 Parents: 0816970 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:46 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/f07a836e/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 7bec994..13f7ec9 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()) {
