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 14:00:19 UTC

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

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

Jacky007 updated ZOOKEEPER-1690:
--------------------------------

    Summary: Race condition when close sock may cause a NPE in sendBuffer   (was: Race condition when close session may cause a NPE in sendBuffer )
    
> Race condition when close sock 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