zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robin <rchzz...@163.com>
Subject Possible logic error in ClientCnxnSocketNIO
Date Tue, 25 Nov 2014 01:10:38 GMT
Hi,
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.

Thanks,
- Robin
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message