You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by up...@apache.org on 2021/03/30 20:21:22 UTC

[geode-benchmarks] 01/03: Adding some timeouts and capturing stdout/stderr for redis cluster tests

This is an automated email from the ASF dual-hosted git repository.

upthewaterspout pushed a commit to branch feature/redis-performance-testing
in repository https://gitbox.apache.org/repos/asf/geode-benchmarks.git

commit 3e21806c229fbd2be1d33bd69f4cc55dafd7187f
Author: Dan Smith <da...@vmware.com>
AuthorDate: Mon Mar 22 15:56:25 2021 -0700

    Adding some timeouts and capturing stdout/stderr for redis cluster tests
---
 .../java/org/apache/geode/benchmark/tasks/ProcessControl.java     | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/ProcessControl.java b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/ProcessControl.java
index 1ea2d4d..3e9e441 100644
--- a/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/ProcessControl.java
+++ b/geode-benchmarks/src/main/java/org/apache/geode/benchmark/tasks/ProcessControl.java
@@ -18,11 +18,13 @@ import static java.lang.String.format;
 import static java.lang.String.join;
 
 import java.io.IOException;
+import java.time.Duration;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class ProcessControl {
+  private static final Duration RETRY_TIMEOUT = Duration.ofMinutes(1);
 
   private static final Logger logger = LoggerFactory.getLogger(ProcessControl.class);
 
@@ -39,6 +41,7 @@ public class ProcessControl {
 
   public static void runAndExpectZeroExit(final ProcessBuilder processBuilder)
       throws IOException, InterruptedException {
+    processBuilder.inheritIO();
     final Process process = processBuilder.start();
     final int exitStatus = process.waitFor();
     if (exitStatus != 0) {
@@ -52,7 +55,9 @@ public class ProcessControl {
 
   public static void retryUntilZeroExit(final ProcessBuilder processBuilder)
       throws IOException, InterruptedException {
+    long start = System.nanoTime();
     while (true) {
+      processBuilder.inheritIO();
       final Process process = processBuilder.start();
       final int exitStatus = process.waitFor();
       if (exitStatus != 0) {
@@ -60,6 +65,9 @@ public class ProcessControl {
             format("'%s' command exited with status %d", join(" ", processBuilder.command()),
                 exitStatus, System.getProperty("user.dir"));
         logger.error(msg);
+        if(System.nanoTime() - start > RETRY_TIMEOUT.toNanos()) {
+          throw new RuntimeException(msg);
+        }
         continue;
       }
       break;