You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Jacky007 (JIRA)" <ji...@apache.org> on 2013/04/15 13:54:15 UTC

[jira] [Created] (ZOOKEEPER-1690) Race condition when close session may cause a NPE in sendBuffer

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