You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 04:49:35 UTC

svn commit: r1077184 - /hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Server.java

Author: omalley
Date: Fri Mar  4 03:49:35 2011
New Revision: 1077184

URL: http://svn.apache.org/viewvc?rev=1077184&view=rev
Log:
commit 9c3478b489569053636ebc2a7132d4af9ad17056
Author: Devaraj Das <dd...@yahoo-inc.com>
Date:   Fri Feb 19 23:55:25 2010 -0800

    HADOOP:6572 from https://issues.apache.org/jira/secure/attachment/12436421/6572-bp20.patch
    
    +++ b/YAHOO-CHANGES.txt
    +    HADOOP-6572. Makes sure that SASL encryption and push to responder queue for the
    +    RPC response happens atomically. (Kan Zhang via ddas)
    +

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Server.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Server.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Server.java?rev=1077184&r1=1077183&r2=1077184&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Server.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Server.java Fri Mar  4 03:49:35 2011
@@ -1193,17 +1193,23 @@ public abstract class Server {
             error = StringUtils.stringifyException(e);
           }
           CurCall.set(null);
-          setupResponse(buf, call, 
+          synchronized (call.connection.responseQueue) {
+            // setupResponse() needs to be sync'ed together with 
+            // responder.doResponse() since setupResponse may use
+            // SASL to encrypt response data and SASL enforces
+            // its own message ordering.
+            setupResponse(buf, call, 
                         (error == null) ? Status.SUCCESS : Status.ERROR, 
                         value, errorClass, error);
-          // Discard the large buf and reset it back to 
-          // smaller size to freeup heap
-          if (buf.size() > MAX_RESP_BUF_SIZE) {
-            LOG.warn("Large response size " + buf.size() + " for call " + 
+            // Discard the large buf and reset it back to 
+            // smaller size to freeup heap
+            if (buf.size() > MAX_RESP_BUF_SIZE) {
+              LOG.warn("Large response size " + buf.size() + " for call " + 
                 call.toString());
-            buf = new ByteArrayOutputStream(INITIAL_RESP_BUF_SIZE);
+              buf = new ByteArrayOutputStream(INITIAL_RESP_BUF_SIZE);
+            }
+            responder.doRespond(call);
           }
-          responder.doRespond(call);
         } catch (InterruptedException e) {
           if (running) {                          // unexpected -- log it
             LOG.info(getName() + " caught: " +