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

nkalmar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 942213d  ZOOKEEPER-3510: Make 'zkServer.sh stop' more reliable
942213d is described below

commit 942213dfe28e464f068f8a195d1424c4b29af585
Author: Damien Diederen <[email protected]>
AuthorDate: Fri Aug 23 12:14:46 2019 +0200

    ZOOKEEPER-3510: Make 'zkServer.sh stop' more reliable
    
    As mentioned in 
https://github.com/apache/zookeeper/pull/1054#discussion_r314208678 :
    
    There is a `sleep 3` statement in `zkServer.sh restart`. I am unable to 
unearth the history of that particular line, but I believe part—if not all—of 
that sleep should be part of `zkServer.sh stop`.
    
    I frequently observe `FAILED TO START` errors in the C test suite; the logs 
consistently show that those are caused by `java.net.BindException: Address 
already in use`. Adding a simple `sleep 1` before `echo STOPPED` "fixes" it for 
me.
    
    As noted in the commit message, the `sleep` is far from optimal, an 
adaptive mechanism would be better—but I do not want to make the first 
iteration too complicated.
    
    Author: Damien Diederen <[email protected]>
    
    Reviewers: Enrico Olivelli <[email protected]>, Norbert Kalmar 
<[email protected]>
    
    Closes #1055 from ztzg/ZOOKEEPER-3510-zkserver-stop-delay
---
 bin/zkServer.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bin/zkServer.sh b/bin/zkServer.sh
index b83848a..ec3db14 100755
--- a/bin/zkServer.sh
+++ b/bin/zkServer.sh
@@ -212,6 +212,7 @@ stop)
     else
       $KILL $(cat "$ZOOPIDFILE")
       rm "$ZOOPIDFILE"
+      sleep 1
       echo STOPPED
     fi
     exit 0

Reply via email to