YARN-485. TestProcfsProcessTree#testProcessTree() doesn't wait long enough for the process to die. (kkambatl via tucu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1457936 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alejandro Abdelnur 2013-03-18 19:44:01 +00:00
parent 53e7aaa6dd
commit d2775d6795
2 changed files with 19 additions and 5 deletions

View File

@ -100,6 +100,9 @@ Release 2.0.5-beta - UNRELEASED
YARN-196. Nodemanager should be more robust in handling connection failure YARN-196. Nodemanager should be more robust in handling connection failure
to ResourceManager when a cluster is started (Xuan Gong via hitesh) to ResourceManager when a cluster is started (Xuan Gong via hitesh)
YARN-485. TestProcfsProcessTree#testProcessTree() doesn't wait long enough
for the process to die. (kkambatl via tucu)
Release 2.0.4-alpha - UNRELEASED Release 2.0.4-alpha - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -18,6 +18,8 @@
package org.apache.hadoop.yarn.util; package org.apache.hadoop.yarn.util;
import static org.junit.Assert.fail;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
@ -188,11 +190,20 @@ public void testProcessTree() throws Exception {
// destroy the process and all its subprocesses // destroy the process and all its subprocesses
destroyProcessTree(pid); destroyProcessTree(pid);
if (isSetsidAvailable()) { // whole processtree should be gone boolean isAlive = true;
Assert.assertFalse("Proceesses in process group live", for (int tries = 100; tries > 0; tries--) {
isAnyProcessInTreeAlive(p)); if (isSetsidAvailable()) {// whole processtree
} else {// process should be gone isAlive = isAnyProcessInTreeAlive(p);
Assert.assertFalse("ProcessTree must have been gone", isAlive(pid)); } else {// process
isAlive = isAlive(pid);
}
if (!isAlive) {
break;
}
Thread.sleep(100);
}
if (isAlive) {
fail("ProcessTree shouldn't be alive");
} }
LOG.info("Process-tree dump follows: \n" + processTreeDump); LOG.info("Process-tree dump follows: \n" + processTreeDump);