hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kih...@apache.org
Subject svn commit: r1595051 - in /hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common: CHANGES.txt src/main/java/org/apache/hadoop/http/HttpServer.java src/main/java/org/apache/hadoop/http/HttpServer2.java
Date Thu, 15 May 2014 21:25:38 GMT
Author: kihwal
Date: Thu May 15 21:25:38 2014
New Revision: 1595051

URL: http://svn.apache.org/r1595051
Log:
HADOOP-10588. Workaround for jetty6 acceptor startup issue. Contributed by Kihwal Lee.

Modified:
    hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer.java
    hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java

Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1595051&r1=1595050&r2=1595051&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/CHANGES.txt Thu May
15 21:25:38 2014
@@ -51,6 +51,8 @@ Release 2.5.0 - UNRELEASED
     HADOOP-10572. Example NFS mount command must pass noacl as it isn't
     supported by the server yet. (Harsh J via brandonli)
 
+    HADOOP-10588. Workaround for jetty6 acceptor startup issue. (kihwal)
+
   OPTIMIZATIONS
 
   BUG FIXES 

Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer.java?rev=1595051&r1=1595050&r2=1595051&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer.java
Thu May 15 21:25:38 2014
@@ -306,9 +306,42 @@ public class HttpServer implements Filte
     return HttpServer.createDefaultChannelConnector();
   }
   
+
+  private static class SelectChannelConnectorWithSafeStartup
+      extends SelectChannelConnector {
+    public SelectChannelConnectorWithSafeStartup() {
+      super();
+    }
+
+    /* Override the broken isRunning() method (JETTY-1316). This bug is present
+     * in 6.1.26. For the versions wihout this bug, it adds insignificant
+     * overhead.
+     */
+    @Override
+    public boolean isRunning() {
+      if (super.isRunning()) {
+        return true;
+      }
+      // We might be hitting JETTY-1316. If the internal state changed from
+      // STARTING to STARTED in the middle of the check, the above call may
+      // return false.  Check it one more time.
+      LOG.warn("HttpServer Acceptor: isRunning is false. Rechecking.");
+      try {
+        Thread.sleep(10);
+      } catch (InterruptedException ie) {
+        // Mark this thread as interrupted. Someone up in the call chain
+        // might care.
+        Thread.currentThread().interrupt();
+      }
+      boolean runState = super.isRunning();
+      LOG.warn("HttpServer Acceptor: isRunning is " + runState);
+      return runState;
+    }
+  }
+
   @InterfaceAudience.Private
   public static Connector createDefaultChannelConnector() {
-    SelectChannelConnector ret = new SelectChannelConnector();
+    SelectChannelConnector ret = new SelectChannelConnectorWithSafeStartup();
     ret.setLowResourceMaxIdleTime(10000);
     ret.setAcceptQueueSize(128);
     ret.setResolveNames(false);

Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java?rev=1595051&r1=1595050&r2=1595051&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java
Thu May 15 21:25:38 2014
@@ -438,9 +438,41 @@ public final class HttpServer2 implement
     return HttpServer2.createDefaultChannelConnector();
   }
 
+  private static class SelectChannelConnectorWithSafeStartup
+      extends SelectChannelConnector {
+    public SelectChannelConnectorWithSafeStartup() {
+      super();
+    }
+
+    /* Override the broken isRunning() method (JETTY-1316). This bug is present
+     * in 6.1.26. For the versions wihout this bug, it adds insignificant
+     * overhead.
+     */
+    @Override
+    public boolean isRunning() {
+      if (super.isRunning()) {
+        return true;
+      }
+      // We might be hitting JETTY-1316. If the internal state changed from
+      // STARTING to STARTED in the middle of the check, the above call may
+      // return false.  Check it one more time.
+      LOG.warn("HttpServer Acceptor: isRunning is false. Rechecking.");
+      try {
+        Thread.sleep(10);
+      } catch (InterruptedException ie) {
+        // Mark this thread as interrupted. Someone up in the call chain
+        // might care.
+        Thread.currentThread().interrupt();
+      }
+      boolean runState = super.isRunning();
+      LOG.warn("HttpServer Acceptor: isRunning is " + runState);
+      return runState;
+    }
+  }
+
   @InterfaceAudience.Private
   public static Connector createDefaultChannelConnector() {
-    SelectChannelConnector ret = new SelectChannelConnector();
+    SelectChannelConnector ret = new SelectChannelConnectorWithSafeStartup();
     ret.setLowResourceMaxIdleTime(10000);
     ret.setAcceptQueueSize(128);
     ret.setResolveNames(false);



Mime
View raw message