[ https://issues.apache.org/jira/browse/ZOOKEEPER-2091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14227396#comment-14227396 ]
Rakesh R commented on ZOOKEEPER-2091: ------------------------------------- Hi, I've seen the following exception in my environment {code} org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1127) java.io.IOException: Nothing in the queue, but got 425467 at org.apache.zookeeper.ClientCnxn$SendThread.readResponse(ClientCnxn.java:788) at org.apache.zookeeper.ClientCnxnSocketNIO.doIO(ClientCnxnSocketNIO.java:94) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:366) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1106) {code} I'm thinking the reason is due to not adding the packet to the 'pendingQueue'. It looks like similar problem occurred here also in the below snippet. What do you say? {code} ClientCnxnSocketNIO.java sock.write(p.bb); if (!p.bb.hasRemaining()) { ..... ..... ..... pendingQueue.add(p); } {code} > 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)