Jacky007 created ZOOKEEPER-1690:
-----------------------------------

             Summary: Race condition when close session may cause a NPE in 
sendBuffer 
                 Key: ZOOKEEPER-1690
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1690
             Project: ZooKeeper
          Issue Type: Bug
    Affects Versions: 3.4.6
            Reporter: Jacky007


In NIOServerCnxn.java
     public void close() {
            closeSock();
            ...
            sk.cancel();

Close sock first, then cancel the channel.
    
    public void sendBuffer(ByteBuffer bb) {
                if ((sk.interestOps() & SelectionKey.OP_WRITE) == 0) {
                        ...
                        sock.write(bb);

Get ops of the channel, then read sock (may be null)

I have noticed that the 3.5.0-branch has fixed the problem.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to