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

mboehm7 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/main by this push:
     new 99840926d6 [SYSTEMDS-3903] Fix federated tests worker process shutdown 
windows
99840926d6 is described below

commit 99840926d63ae43278e281a26f7a11f9c4fae16e
Author: Matthias Boehm <mboe...@gmail.com>
AuthorDate: Thu Jul 31 13:07:07 2025 +0200

    [SYSTEMDS-3903] Fix federated tests worker process shutdown windows
    
    A recent commit added the graceful termination w/ kill -SIGINT before
    waiting and then forcefully destroying the process. Due to the POSIX-
    specific command these tests now locally failed on windows. This patch
    fixes it by attempting a taskkill on windows (which without /F usually
    fails to terminate though) and then uses the standard termination.
---
 src/test/java/org/apache/sysds/test/TestUtils.java | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/test/java/org/apache/sysds/test/TestUtils.java 
b/src/test/java/org/apache/sysds/test/TestUtils.java
index 195e36d606..a1fae4f84a 100644
--- a/src/test/java/org/apache/sysds/test/TestUtils.java
+++ b/src/test/java/org/apache/sysds/test/TestUtils.java
@@ -3493,21 +3493,23 @@ public class TestUtils {
                if( t != null ) {
                        sendSigInt(t);// Attempt graceful termination
                        try {
-            // Wait up to 1 second for the process to exit
-            if (!t.waitFor(10, TimeUnit.SECONDS)) {
-                // If still alive after 1 second, force kill
-                Process forciblyDestroyed = t.destroyForcibly();
-                forciblyDestroyed.waitFor(); // Wait until it's definitely 
terminated
-            }
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
+                               // Wait up to 1 second for the process to exit
+                               if (!t.waitFor(10, TimeUnit.SECONDS)) {
+                                       // If still alive after 1 second, force 
kill
+                                       Process forciblyDestroyed = 
t.destroyForcibly();
+                                       forciblyDestroyed.waitFor(); // Wait 
until it's definitely terminated
+                               }
+                       } catch (InterruptedException e) {
+                               e.printStackTrace();
+                       }
                }
        }
 
        public static void sendSigInt(Process process) {
                long pid = process.pid();
-               ProcessBuilder pb = new ProcessBuilder("kill", "-SIGINT", 
Long.toString(pid));
+               ProcessBuilder pb = 
System.getProperty("os.name").startsWith("Win") ?
+                       new ProcessBuilder("taskkill", "/pid", 
Long.toString(pid)) : // add "/F" to force
+                       new ProcessBuilder("kill", "-SIGINT", 
Long.toString(pid));
                try {
                        pb.inheritIO().start().waitFor();
                }

Reply via email to