You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by iv...@apache.org on 2018/02/13 16:53:26 UTC

[bookkeeper] branch branch-4.6 updated: Fix shutdown race which left ZK session open

This is an automated email from the ASF dual-hosted git repository.

ivank pushed a commit to branch branch-4.6
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/branch-4.6 by this push:
     new 3b232d6  Fix shutdown race which left ZK session open
3b232d6 is described below

commit 3b232d6de2f5d40fde39746e25cf9aea33ab6bec
Author: Ivan Kelly <iv...@apache.org>
AuthorDate: Tue Feb 13 17:52:54 2018 +0100

    Fix shutdown race which left ZK session open
    
    There was a race when shutting down a bookie, where both the main
    thread and the shutdown hook thread would try to close the bookie
    service. This would result in them racing to set the lifecycle state
    and neither would end up cleaning up properly. Specifically, the
    starter latch would be counted down, so the main thread would start to
    close, then the shutdown hook would run, try to close, and get an
    exception when it tried to change the state. Once the all shutdown
    hooks end, the process exits, even if main hasn't completed. This
    leaves the zookeeper session open.
    
    I've removed the close from main(). The shutdown hook always runs
    on a graceful shutdown, so that's the place to do the cleanup.
    
    Author: Ivan Kelly <iv...@apache.org>
    
    Reviewers: Enrico Olivelli <eo...@gmail.com>, Sijie Guo <si...@apache.org>
    
    This closes #1132 from ivankelly/shut-race
    
    (cherry picked from commit 89eca5ce717a04c6e3ffa2b0aca615f4e38eafe3)
    Signed-off-by: Ivan Kelly <iv...@apache.org>
---
 bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java
index c2f7b8e..5ee8bb5 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java
@@ -219,7 +219,6 @@ public class Main {
             // the server is interrupted
             log.info("Bookie server is interrupted. Exiting ...");
         }
-        server.close();
         return ExitCode.OK;
     }
 

-- 
To stop receiving notification emails like this one, please contact
ivank@apache.org.