[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14227572#comment-14227572
 ] 

Cheng commented on ZOOKEEPER-2091:
----------------------------------

Hi Rakesh,

By the following call flow:
    SendThread#run()
      -> ZooKeeperSaslClient#initialize()
        -> ZooKeeperSaslClient#sendSaslPacket()
          -> ClientCnxn#sendPacket()
            -> SendThread#sendPacket()
              -> ClientCnxnSocketNIO#sendPacket() 
It seems that the SaslPacket has been put into the pendingQueue after it is 
sent to the ZooKeeper Server. So when the SASL response comes, it will not find 
the corresponding Packet in the pendingQueue.

Is the analysis correct ?

> Possible logic error in ClientCnxnSocketNIO
> -------------------------------------------
>
>                 Key: ZOOKEEPER-2091
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2091
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: java client
>    Affects Versions: 3.4.6
>            Reporter: Cheng
>            Priority: Minor
>
> When SASL authentication is enabled, the ZooKeeper client will finally call 
> ClientCnxnSocketNIO#sendPacket(Packet p) to send a packet to server:
> @Override
> void sendPacket(Packet p) throws IOException {
>     SocketChannel sock = (SocketChannel) sockKey.channel();
>     if (sock == null) {
>         throw new IOException("Socket is null!");
>     }
>     p.createBB();
>     ByteBuffer pbb = p.bb;
>     sock.write(pbb);
> }
> One problem I can see is that the sock is non-blocking, so when the sock's 
> output buffer is full(theoretically), only part of the Packet is sent out and 
> the communication will break.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to