ZooKeeper Standalone does not shutdown cleanly
----------------------------------------------

                 Key: ZOOKEEPER-1047
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1047
             Project: ZooKeeper
          Issue Type: Bug
          Components: server
    Affects Versions: 3.3.3
            Reporter: Gunnar Wagenknecht


When I shutdown a standalone ZooKeeper server (programmatically) I get the 
following exception logged. Occasionally, no exception is logged. 
{noformat}
10:32:43.353 [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] WARN  
o.a.zookeeper.server.NIOServerCnxn - Ignoring unexpected runtime exception
java.nio.channels.CancelledKeyException: null
        at sun.nio.ch.SelectionKeyImpl.ensureValid(SelectionKeyImpl.java:55) 
~[na:1.6.0_24]
        at sun.nio.ch.SelectionKeyImpl.readyOps(SelectionKeyImpl.java:69) 
~[na:1.6.0_24]
        at 
org.apache.zookeeper.server.NIOServerCnxn$Factory.run(NIOServerCnxn.java:241) 
~[na:na]
10:32:43.353 [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] INFO  
o.a.zookeeper.server.NIOServerCnxn - NIOServerCnxn factory exited run method
10:32:43.387 [SyncThread:0] INFO  o.a.z.server.SyncRequestProcessor - 
SyncRequestProcessor exited!
10:32:43.387 [ProcessThread:-1] INFO  o.a.z.server.PrepRequestProcessor - 
PrepRequestProcessor exited loop!
10:32:43.387 [app thread] INFO  o.a.z.server.FinalRequestProcessor - shutdown 
of request processor complete
{noformat}

Because it's logged with a WARN level, my assumption is that something is wrong 
on shutdown. However, I follow the exact same shutdown order than 
ZooKeeperMain, i.e. shutdown the {{NIOServerCnxn.Factory}} first and shutdown 
the {{ZooKeeperServer}} instance thereafter if its still running.

{noformat}
...
factory.shutdown();
factory = null;

if (zkServer.isRunning()) {
        zkServer.shutdown();
}
zkServer = null;
{noformat}




--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to