OpenJDK / amber / amber
changeset 58288:e98509cb3867
8230957: [TESTBUG] containers/docker/TestJcmdWithSideCar.java sporadic failures
Reviewed-by: clanger, bobv, mseledtsov
author | mbaesken |
---|---|
date | Fri, 11 Oct 2019 09:55:35 +0200 |
parents | 9d9317fad3fe |
children | 85e5124b0376 |
files | test/hotspot/jtreg/containers/docker/EventGeneratorLoop.java test/hotspot/jtreg/containers/docker/TestJcmdWithSideCar.java |
diffstat | 2 files changed, 21 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/test/hotspot/jtreg/containers/docker/EventGeneratorLoop.java Fri Oct 11 09:43:18 2019 +0200 +++ b/test/hotspot/jtreg/containers/docker/EventGeneratorLoop.java Fri Oct 11 09:55:35 2019 +0200 @@ -45,7 +45,7 @@ } int howLong = Integer.parseInt(args[0]); - System.out.println(MAIN_METHOD_STARTED); + System.out.println(MAIN_METHOD_STARTED + ", argument is " + howLong); for (int i=0; i < howLong; i++) { SimpleEvent ev = new SimpleEvent(); @@ -56,6 +56,8 @@ try { Thread.sleep(1000); } catch (InterruptedException e) {} System.out.print("."); } + + System.out.println("EventGeneratorLoop is coming to an end"); } }
--- a/test/hotspot/jtreg/containers/docker/TestJcmdWithSideCar.java Fri Oct 11 09:43:18 2019 +0200 +++ b/test/hotspot/jtreg/containers/docker/TestJcmdWithSideCar.java Fri Oct 11 09:55:35 2019 +0200 @@ -56,7 +56,7 @@ public class TestJcmdWithSideCar { private static final String IMAGE_NAME = Common.imageName("jfr-jcmd"); private static final int TIME_TO_RUN_MAIN_PROCESS = (int) (30 * Utils.TIMEOUT_FACTOR); // seconds - private static final long TIME_TO_WAIT_FOR_MAIN_METHOD_START = 5 * 1000; // milliseconds + private static final long TIME_TO_WAIT_FOR_MAIN_METHOD_START = 50 * 1000; // milliseconds private static final String MAIN_CONTAINER_NAME = "test-container-main"; public static void main(String[] args) throws Exception { @@ -198,6 +198,8 @@ .addDockerOpts("--volume", Paths.get(".").toAbsolutePath() + ":/workdir/") .addJavaOpts("-XX:+UsePerfData") .addClassOptions("" + TIME_TO_RUN_MAIN_PROCESS); + // avoid large Xmx + opts.appendTestJavaOptions = false; List<String> cmd = DockerTestUtils.buildJavaCommand(opts); ProcessBuilder pb = new ProcessBuilder(cmd); @@ -232,9 +234,21 @@ } public void waitForAndCheck(long timeout) throws Exception { - waitFor(timeout); - if (p.exitValue() != 0) { - throw new RuntimeException("DockerThread stopped unexpectedly"); + int exitValue = -1; + int retryCount = 3; + + do { + waitFor(timeout); + try { + exitValue = p.exitValue(); + } catch(IllegalThreadStateException ex) { + System.out.println("IllegalThreadStateException occured when calling exitValue()"); + retryCount--; + } + } while (exitValue == -1 && retryCount > 0); + + if (exitValue != 0) { + throw new RuntimeException("DockerThread stopped unexpectedly, non-zero exit value is " + exitValue); } }