zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "maoling (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (ZOOKEEPER-3158) firstConnect.countDown() will not be executed where sendThread.primeConnection() has thrown an exception
Date Sat, 29 Sep 2018 03:49:00 GMT

     [ https://issues.apache.org/jira/browse/ZOOKEEPER-3158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

maoling updated ZOOKEEPER-3158:
-------------------------------
    Description: 
look at the source code in the ClientCnxnSocketNetty.connect(InetSocketAddress):

{code:java}
public void operationComplete(ChannelFuture channelFuture) throws Exception {
            // this lock guarantees that channel won't be assgined after cleanup().
            connectLock.lock();
                try {
                    //----------------------
                    sendThread.primeConnection();
                    //-----------------------
                    firstConnect.countDown();
                    LOG.info("channel is connected: {}", channelFuture.getChannel());
                } finally {
                    connectLock.unlock();
                }
            }
 });
{code}

firstConnect.countDown() will not be executed where sendThread.primeConnection() has thrown
an exception,it should be put into finally code block. 

  was:
look at the source code in the ClientCnxnSocketNetty.connect(InetSocketAddress):
*public void operationComplete(ChannelFuture channelFuture) throws Exception {
            // this lock guarantees that channel won't be assgined after cleanup().
            connectLock.lock();
                try {
                    //----------------------
                    sendThread.primeConnection();
                    //-----------------------
                    firstConnect.countDown();
                    LOG.info("channel is connected: {}", channelFuture.getChannel());
                } finally {
                    connectLock.unlock();
                }
            }
 });*
firstConnect.countDown() will not be executed where sendThread.primeConnection() has thrown
an exception,it should be put into finally code block. 


> firstConnect.countDown() will not be executed where sendThread.primeConnection() has
thrown an exception
> --------------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-3158
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3158
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>            Reporter: maoling
>            Priority: Trivial
>
> look at the source code in the ClientCnxnSocketNetty.connect(InetSocketAddress):
> {code:java}
> public void operationComplete(ChannelFuture channelFuture) throws Exception {
>             // this lock guarantees that channel won't be assgined after cleanup().
>             connectLock.lock();
>                 try {
>                     //----------------------
>                     sendThread.primeConnection();
>                     //-----------------------
>                     firstConnect.countDown();
>                     LOG.info("channel is connected: {}", channelFuture.getChannel());
>                 } finally {
>                     connectLock.unlock();
>                 }
>             }
>  });
> {code}
> firstConnect.countDown() will not be executed where sendThread.primeConnection() has
thrown an exception,it should be put into finally code block. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message