OpenJDK / code-tools / jcstress
changeset 408:9e1246a9d0d0
7902024: Timeout handling should be more relaxed
author | shade |
---|---|
date | Fri, 01 Sep 2017 12:43:30 +0200 |
parents | f761bd60f8e2 |
children | c19f9cbf151e |
files | jcstress-core/src/main/java/org/openjdk/jcstress/infra/processors/JCStressTestProcessor.java jcstress-core/src/main/java/org/openjdk/jcstress/infra/runners/Runner.java |
diffstat | 2 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/processors/JCStressTestProcessor.java Thu Aug 31 16:32:40 2017 +0200 +++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/processors/JCStressTestProcessor.java Fri Sep 01 12:43:30 2017 +0200 @@ -826,7 +826,7 @@ pw.println(" }"); pw.println(); pw.println(" try {"); - pw.println(" t1.join(config.time);"); + pw.println(" t1.join(Math.max(2*config.time, Runner.MIN_TIMEOUT_MS));"); pw.println(" } catch (InterruptedException e) {"); pw.println(" // do nothing"); pw.println(" }");
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/runners/Runner.java Thu Aug 31 16:32:40 2017 +0200 +++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/runners/Runner.java Fri Sep 01 12:43:30 2017 +0200 @@ -46,6 +46,8 @@ * @author Aleksey Shipilev (aleksey.shipilev@oracle.com) */ public abstract class Runner<R> { + protected static final int MIN_TIMEOUT_MS = 30*1000; + protected final Control control; protected final TestResultCollector collector; protected final ExecutorService pool; @@ -140,8 +142,9 @@ } } - if (TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime) > Math.max(config.time, 60*1000)) { - dumpFailure(-1, Status.TIMEOUT_ERROR, "Timeout out waiting for tasks to complete"); + long timeSpent = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime); + if (timeSpent > Math.max(2*config.time, MIN_TIMEOUT_MS)) { + dumpFailure(-1, Status.TIMEOUT_ERROR, "Timeout waiting for tasks to complete: " + timeSpent + " ms"); return; } }