Skip to content

Commit 79f37d0

Browse files
authored
MAPREDUCE-7517 TestPipeApplication hangs with JAVA 17+ (#7952) Contributed by Istvan Toth.
* MAPREDUCE-7517 TestPipeApplication hangs with JAVA 17+ * add comment about JRE path Reviewed-by: Cheng Pan <[email protected]> Signed-off-by: Shilun Fan <[email protected]>
1 parent 3840e8a commit 79f37d0

File tree

1 file changed

+6
-1
lines changed
  • hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/pipes

1 file changed

+6
-1
lines changed

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/pipes/TestPipeApplication.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import java.util.List;
3636
import java.util.Map;
3737
import java.util.Map.Entry;
38+
import java.util.concurrent.TimeUnit;
3839

3940
import org.apache.hadoop.fs.CommonConfigurationKeys;
4041
import org.apache.hadoop.fs.FileSystem;
@@ -69,12 +70,15 @@
6970
import org.apache.hadoop.util.Progressable;
7071
import org.apache.hadoop.yarn.security.AMRMTokenIdentifier;
7172
import org.junit.jupiter.api.Test;
73+
import org.junit.jupiter.api.Timeout;
7274

7375
import static org.junit.jupiter.api.Assertions.assertEquals;
7476
import static org.junit.jupiter.api.Assertions.assertNotNull;
7577
import static org.junit.jupiter.api.Assertions.assertTrue;
7678
import static org.junit.jupiter.api.Assertions.fail;
79+
import static org.junit.jupiter.api.Timeout.ThreadMode.SEPARATE_THREAD;
7780

81+
@Timeout(value=10, unit = TimeUnit.SECONDS, threadMode = SEPARATE_THREAD)
7882
public class TestPipeApplication {
7983
private static File workSpace = new File("target",
8084
TestPipeApplication.class.getName() + "-workSpace");
@@ -614,7 +618,8 @@ private File getFileCommand(String clazz) throws Exception {
614618
if (clazz == null) {
615619
os.write(("ls ").getBytes());
616620
} else {
617-
os.write(("java -cp " + classpath + " " + clazz).getBytes());
621+
// On Java 8 java.home returns "${JAVA_HOME}/jre", but that's good enough for this test
622+
os.write((System.getProperty("java.home") + "/bin/java -cp " + classpath + " " + clazz).getBytes());
618623
}
619624
os.flush();
620625
os.close();

0 commit comments

Comments
 (0)