From d287ec5cf2787909dafc774a510c85c3747f7eaa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Janis=20Daniel=20D=C3=A4hne?=
 <janis.daehne2@student.uni-halle.de>
Date: Mon, 14 Nov 2016 22:51:45 +0100
Subject: [PATCH] - the 100% cpu was from forever running user programs ...
 p.waitFor won't kill the process!!

---
 src/Main.java | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/Main.java b/src/Main.java
index 28770e4..6519626 100644
--- a/src/Main.java
+++ b/src/Main.java
@@ -133,13 +133,8 @@ public class Main {
     static String DefaultCGroupName = "syndrom";
 
 
-
-
     public static void main(String[] myArgs) throws IOException {
 
-
-
-
         if (isDebug) {
             System.out.println(Arrays.toString(myArgs));
         }
@@ -437,7 +432,6 @@ public class Main {
             }
         }
 
-
         List<String> cmdToEx = transformCommandWithSpecialStrings(directoryFile, mainFile,
                 mainFileNameWithExtension, executeTestCmd, timeoutInMs, memoryLimitInKb, diskLimitInKb,
                 sourceFileExtensionsWithoutDot);
@@ -452,7 +446,6 @@ public class Main {
             cmdToEx.addAll(_arguments);
         }
 
-
         if (isDebug) {
             System.out.println(Arrays.toString(cmdToEx.toArray()));
         }
@@ -695,6 +688,12 @@ public class Main {
             futureResult = -100;
         }
 
+
+        //p.waitFor will NOT TERMINATE the process in any way...
+        //... so finally kill the process (if it's not already finished)
+        //else an infinitely loop would run forever
+        p.destroy();
+
         if (isDebug) {
             timer.end();
             System.out.println("time for running process in ms :"  + timer.getTotalTimeInMs());
-- 
GitLab