|
@@ -963,9 +963,19 @@ public class TaskTracker
|
|
server.addInternalServlet("taskLog", "/tasklog", TaskLogServlet.class);
|
|
server.addInternalServlet("taskLog", "/tasklog", TaskLogServlet.class);
|
|
server.start();
|
|
server.start();
|
|
this.httpPort = server.getPort();
|
|
this.httpPort = server.getPort();
|
|
|
|
+ checkJettyPort(httpPort);
|
|
initialize();
|
|
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 {
|
|
private void startCleanupThreads() throws IOException {
|
|
taskCleanupThread.setDaemon(true);
|
|
taskCleanupThread.setDaemon(true);
|
|
taskCleanupThread.start();
|
|
taskCleanupThread.start();
|
|
@@ -1133,6 +1143,11 @@ public class TaskTracker
|
|
if (!acceptNewTasks && isIdle()) {
|
|
if (!acceptNewTasks && isIdle()) {
|
|
acceptNewTasks=true;
|
|
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) {
|
|
} catch (InterruptedException ie) {
|
|
LOG.info("Interrupted. Closing down.");
|
|
LOG.info("Interrupted. Closing down.");
|
|
return State.INTERRUPTED;
|
|
return State.INTERRUPTED;
|