hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r772844 - in /hadoop/core/trunk: CHANGES.txt src/core/org/apache/hadoop/http/HttpServer.java src/mapred/org/apache/hadoop/mapred/TaskTracker.java
Date Fri, 08 May 2009 05:27:56 GMT
Author: ddas
Date: Fri May  8 05:27:55 2009
New Revision: 772844

URL: http://svn.apache.org/viewvc?rev=772844&view=rev
Log:
HADOOP-4744. Attaching another fix to the jetty port issue. The TaskTracker kills itself if
it ever discovers that the port to which jetty is actuallybound is invalid (-1). Contributed
by Devaraj Das.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/core/org/apache/hadoop/http/HttpServer.java
    hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskTracker.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=772844&r1=772843&r2=772844&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Fri May  8 05:27:55 2009
@@ -576,6 +576,10 @@
     HADOOP-5719. Remove jobs that failed initialization from the waiting queue
     in the capacity scheduler. (Sreekanth Ramakrishnan via yhemanth)
 
+    HADOOP-4744. Attaching another fix to the jetty port issue. The TaskTracker
+    kills itself if it ever discovers that the port to which jetty is actually
+    bound is invalid (-1). (ddas)
+
 Release 0.20.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/trunk/src/core/org/apache/hadoop/http/HttpServer.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/core/org/apache/hadoop/http/HttpServer.java?rev=772844&r1=772843&r2=772844&view=diff
==============================================================================
--- hadoop/core/trunk/src/core/org/apache/hadoop/http/HttpServer.java (original)
+++ hadoop/core/trunk/src/core/org/apache/hadoop/http/HttpServer.java Fri May  8 05:27:55
2009
@@ -419,8 +419,15 @@
       int oriPort = listener.getPort(); // The original requested port
       while (true) {
         try {
+          port = webServer.getConnectors()[0].getLocalPort();
+          LOG.info("Port returned by webServer.getConnectors()[0]." +
+          		"getLocalPort() before open() is "+ port + 
+          		". Opening the listener on " + oriPort);
           listener.open();
           port = listener.getLocalPort();
+          LOG.info("listener.getLocalPort() returned " + listener.getLocalPort() + 
+                " webServer.getConnectors()[0].getLocalPort() returned " +
+                webServer.getConnectors()[0].getLocalPort());
           //Workaround to handle the problem reported in HADOOP-4744
           if (port < 0) {
             Thread.sleep(100);

Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskTracker.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskTracker.java?rev=772844&r1=772843&r2=772844&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskTracker.java (original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskTracker.java Fri May  8 05:27:55
2009
@@ -976,9 +976,19 @@
     server.addInternalServlet("taskLog", "/tasklog", TaskLogServlet.class);
     server.start();
     this.httpPort = server.getPort();
+    checkJettyPort(httpPort);
     initialize();
   }
 
+  private void checkJettyPort(int port) throws IOException { 
+    //See HADOOP-4744
+    if (port < 0) {
+      shuttingDown = true;
+      throw new IOException("Jetty problem. Jetty didn't bind to a " +
+      		"valid port");
+    }
+  }
+  
   private void startCleanupThreads() throws IOException {
     taskCleanupThread.setDaemon(true);
     taskCleanupThread.start();
@@ -1146,6 +1156,11 @@
         if (!acceptNewTasks && isIdle()) {
           acceptNewTasks=true;
         }
+        //The check below may not be required every iteration but we are 
+        //erring on the side of caution here. We have seen many cases where
+        //the call to jetty's getLocalPort() returns different values at 
+        //different times. Being a real paranoid here.
+        checkJettyPort(server.getPort());
       } catch (InterruptedException ie) {
         LOG.info("Interrupted. Closing down.");
         return State.INTERRUPTED;



Mime
View raw message