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

Raul Gutierrez Segales commented on ZOOKEEPER-2012:
---------------------------------------------------

in src/java/main/org/apache/zookeeper/ClientCnxn.java:

{noformat}
-            Packet packet;
-            synchronized (pendingQueue) {
-                if (pendingQueue.size() == 0) {
-                    throw new IOException("Nothing in the queue, but got "
+            Packet packet = null;
+            try {
+                synchronized (pendingQueue) {
+                    if (pendingQueue.size() == 0) {
+                        throw new IOException("Nothing in the queue, but got "
                             + replyHdr.getXid());
+                    }
+                    packet = pendingQueue.remove();
                 }
-                packet = pendingQueue.remove();
-            }
{noformat}

won't actually change anything, since finishPacket in the finally block will be 
a no-op with packet == null. or what do you actually win by adding this inside 
of the try block?

> HBase client hangs after client-side OOM
> ----------------------------------------
>
>                 Key: ZOOKEEPER-2012
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2012
>             Project: ZooKeeper
>          Issue Type: Bug
>            Reporter: Qiang Tian
>            Priority: Minor
>         Attachments: ZOOKEEPER-2012-trunk.patch
>
>
> please see 
> http://apache-hbase.679495.n3.nabble.com/HBase-client-hangs-after-client-side-OOM-td4062675.html.
> it looks the send thread caught the error successfully, as it is finally 
> running fine.. but the cleanup fail to notify the main thread...so I suspect 
> it is a very small timing hole that the packet is not on the 2 queues at the 
> same time..it looks it could happen in the latest code 
> ClientCnxnSocketNIO#doIO as well..
> potential fixes:
> 1)add timeout during wait
> 2)try/catch for the possible timing hole:
> {code}
>                   if (!p.bb.hasRemaining()) {
>                         sentCount++;
>                         outgoingQueue.removeFirstOccurrence(p);
>                         if (p.requestHeader != null
>                                 && p.requestHeader.getType() != OpCode.ping
>                                 && p.requestHeader.getType() != OpCode.auth) {
>                             synchronized (pendingQueue) {
>                                 pendingQueue.add(p);
>                             }
>                         }
>                     }
> {code}
> thoughts?
> thanks.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to