From 30569d930f92c4f01c0c6c523c84ef1a9993bead Mon Sep 17 00:00:00 2001 From: Jian He Date: Mon, 14 Sep 2015 17:48:31 +0800 Subject: [PATCH] YARN-4153. TestAsyncDispatcher failed at branch-2.7. Contributed by Zhihai Xu --- .../java/org/apache/hadoop/util/JvmPauseMonitor.java | 12 +++++++----- hadoop-yarn-project/CHANGES.txt | 2 ++ .../apache/hadoop/yarn/event/AsyncDispatcher.java | 7 +++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/JvmPauseMonitor.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/JvmPauseMonitor.java index 1fe77964514..cd5afc652c8 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/JvmPauseMonitor.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/JvmPauseMonitor.java @@ -83,11 +83,13 @@ public class JvmPauseMonitor { public void stop() { shouldRun = false; - monitorThread.interrupt(); - try { - monitorThread.join(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); + if (monitorThread != null) { + monitorThread.interrupt(); + try { + monitorThread.join(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } } } diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index c10fac41d24..0dcb6286115 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -71,6 +71,8 @@ Release 2.7.2 - UNRELEASED YARN-4096. App local logs are leaked if log aggregation fails to initialize for the app. (Jason Lowe via zxu) + YARN-4153. TestAsyncDispatcher failed at branch-2.7 (Zhihai Xu via jianhe) + Release 2.7.1 - 2015-07-06 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/event/AsyncDispatcher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/event/AsyncDispatcher.java index db4d3265c3e..6cdfaad839b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/event/AsyncDispatcher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/event/AsyncDispatcher.java @@ -144,9 +144,12 @@ public class AsyncDispatcher extends AbstractService implements Dispatcher { YarnConfiguration.DEFAULT_DISPATCHER_DRAIN_EVENTS_TIMEOUT); synchronized (waitForDrained) { - while (!drained && eventHandlingThread.isAlive()) { + while (!drained && eventHandlingThread != null + && eventHandlingThread.isAlive() + && System.currentTimeMillis() < endTime) { waitForDrained.wait(1000); - LOG.info("Waiting for AsyncDispatcher to drain."); + LOG.info("Waiting for AsyncDispatcher to drain. Thread state is :" + + eventHandlingThread.getState()); } } }