hadoop-zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maha...@apache.org
Subject svn commit: r888527 - in /hadoop/zookeeper/branches/branch-3.1: CHANGES.txt src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java
Date Tue, 08 Dec 2009 19:15:14 GMT
Author: mahadev
Date: Tue Dec  8 19:15:13 2009
New Revision: 888527

URL: http://svn.apache.org/viewvc?rev=888527&view=rev
Log:
ZOOKEEPER-597. ASyncHammerTest is failing intermittently on hudson trunk. (pat, ben and mahadev)

Modified:
    hadoop/zookeeper/branches/branch-3.1/CHANGES.txt
    hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
    hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java

Modified: hadoop/zookeeper/branches/branch-3.1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.1/CHANGES.txt?rev=888527&r1=888526&r2=888527&view=diff
==============================================================================
--- hadoop/zookeeper/branches/branch-3.1/CHANGES.txt (original)
+++ hadoop/zookeeper/branches/branch-3.1/CHANGES.txt Tue Dec  8 19:15:13 2009
@@ -10,6 +10,9 @@
   ZOOKEEPER-582. ZooKeeper can revert to old data when a snapshot is created
   outside of normal processing (ben reed and mahadev via mahadev)
 
+  ZOOKEEPER-597. ZOOKEEPER-597. ASyncHammerTest is failing intermittently on
+  hudson trunk. (pat, ben and mahadev)
+
 Release 3.1.1 - 2009-03-17
 
 Backward compatibile changes:

Modified: hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java?rev=888527&r1=888526&r2=888527&view=diff
==============================================================================
--- hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
(original)
+++ hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
Tue Dec  8 19:15:13 2009
@@ -268,16 +268,20 @@
     LinkedList<Request> outstanding = new LinkedList<Request>();
 
     void sendBuffer(ByteBuffer bb) {
-        synchronized (factory) {
-            sk.selector().wakeup();
-            if (LOG.isTraceEnabled()) {
-                LOG.trace("Add a buffer to outgoingBuffers, sk " + sk
-                        + " is valid: " + sk.isValid());
-            }
-            outgoingBuffers.add(bb);
-            if (sk.isValid()) {
-                sk.interestOps(sk.interestOps() | SelectionKey.OP_WRITE);
+        try {
+            synchronized (factory) {
+                sk.selector().wakeup();
+                if (LOG.isTraceEnabled()) {
+                    LOG.trace("Add a buffer to outgoingBuffers, sk " + sk
+                            + " is valid: " + sk.isValid());
+                }
+                outgoingBuffers.add(bb);
+                if (sk.isValid()) {
+                    sk.interestOps(sk.interestOps() | SelectionKey.OP_WRITE);
+                }
             }
+        } catch (Exception e) {
+            LOG.warn("Unexpected Exception: ", e);
         }
     }
 
@@ -803,39 +807,44 @@
      *      org.apache.jute.Record, java.lang.String)
      */
     synchronized public void sendResponse(ReplyHeader h, Record r, String tag) {
-        if (closed) {
-            return;
-        }
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        // Make space for length
-        BinaryOutputArchive bos = BinaryOutputArchive.getArchive(baos);
         try {
-            baos.write(fourBytes);
-            bos.writeRecord(h, "header");
+            if (closed) {
+                return;
+            }
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            // Make space for length
+            BinaryOutputArchive bos = BinaryOutputArchive.getArchive(baos);
+            try {
+                baos.write(fourBytes);
+                bos.writeRecord(h, "header");
             if (r != null) {
                 bos.writeRecord(r, tag);
             }
-            baos.close();
-        } catch (IOException e) {
-            LOG.error("Error serializing response");
-        }
-        byte b[] = baos.toByteArray();
-        ByteBuffer bb = ByteBuffer.wrap(b);
-        bb.putInt(b.length - 4).rewind();
-        sendBuffer(bb);
-        if (h.getXid() > 0) {
-            synchronized (this.factory) {
-                outstandingRequests--;
-                // check throttling
-                if (zk.getInProcess() < factory.outstandingLimit
-                        || outstandingRequests < 1) {
-                    sk.selector().wakeup();
-                    enableRecv();
+                baos.close();
+            } catch (IOException e) {
+                LOG.error("Error serializing response");
+            }
+            byte b[] = baos.toByteArray();
+            ByteBuffer bb = ByteBuffer.wrap(b);
+            bb.putInt(b.length - 4).rewind();
+            sendBuffer(bb);
+            if (h.getXid() > 0) {
+                synchronized (this.factory) {
+                    outstandingRequests--;
+                    // check throttling
+                    if (zk.getInProcess() < factory.outstandingLimit
+                            || outstandingRequests < 1) {
+                        sk.selector().wakeup();
+                        enableRecv();
+                    }
                 }
             }
+        } catch(Exception e) {
+            LOG.warn("Unexpected exception. Destruction averted.", e);
         }
     }
 
+
     /*
      * (non-Javadoc)
      *

Modified: hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java?rev=888527&r1=888526&r2=888527&view=diff
==============================================================================
--- hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java
(original)
+++ hadoop/zookeeper/branches/branch-3.1/src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java
Tue Dec  8 19:15:13 2009
@@ -143,6 +143,8 @@
             }
         } catch (Exception e) {
             LOG.error("Unexpected exception causing exit", e);
+        } catch (Throwable e) {
+            LOG.error("Unexpected exception causing CommitProcessor to exit", e);
         }
         LOG.info("CommitProcessor exited loop!");
     }



Mime
View raw message