[ 
https://issues.apache.org/jira/browse/TWILL-133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14586348#comment-14586348
 ] 

ASF GitHub Bot commented on TWILL-133:
--------------------------------------

Github user chtyim commented on a diff in the pull request:

    https://github.com/apache/incubator-twill/pull/41#discussion_r32444480
  
    --- Diff: 
twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/DefaultZKClientService.java
 ---
    @@ -479,12 +498,26 @@ public void run() {
          * Creates a new ZooKeeper connection.
          */
         private ZooKeeper createZooKeeper() throws IOException {
    -      ZooKeeper zk = new ZooKeeper(zkStr, sessionTimeout, this);
    +      ZooKeeper zk = new ZooKeeper(zkStr, sessionTimeout, 
wrapWatcher(this));
           for (Map.Entry<String, byte[]> authInfo : authInfos.entries()) {
             zk.addAuthInfo(authInfo.getKey(), authInfo.getValue());
           }
           return zk;
         }
    +
    +    /**
    +     * Closes the given {@link ZooKeeper} if it is not null. If there is 
InterruptedException,
    +     * it will get logged.
    +     */
    +    private void closeZooKeeper(@Nullable ZooKeeper zk) {
    +      try {
    +        if (zk != null) {
    +          zk.close();
    +        }
    +      } catch (InterruptedException e) {
    --- End diff --
    
    added


> ZookeeperClientService may hang at startup and then cannot be stopped
> ---------------------------------------------------------------------
>
>                 Key: TWILL-133
>                 URL: https://issues.apache.org/jira/browse/TWILL-133
>             Project: Apache Twill
>          Issue Type: Bug
>            Reporter: Andreas Neumann
>
> If the Zookeeper quorum is configured incorrectly, then the ZK client service 
> will wait for ZK to come up, and it won't start until it can connect to ZK. 
> While it is in this state, it can now not be stopped, because stop() will 
> wait for the state to become RUNNING before it does anything. 
> There should be a way to stop a service that hangs at startup. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to