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

gnodet pushed a commit to branch fix-wsrm-executor-leak
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit bdbf3055c5c839d36121a259eff4673c2ff7e67a
Author: Guillaume Nodet <[email protected]>
AuthorDate: Thu Mar 12 17:44:53 2026 +0100

    Fix ExecutorService leak in WS-RM oneway tests
    
    DeliveryAssuranceOnewayTest and MessageCallbackOnewayTest create
    ExecutorService instances via Executors.newSingleThreadExecutor() but
    never shut them down. The leaked non-daemon threads prevent clean test
    completion, causing intermittent timeouts in CI (~95-100s for
    DeliveryAssurance, ~75s for MessageCallback).
    
    Track the ExecutorService and shut it down in tearDown() with a
    10-second grace period before forceful termination.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 .../cxf/systest/ws/rm/DeliveryAssuranceOnewayTest.java       | 11 +++++++++++
 .../apache/cxf/systest/ws/rm/MessageCallbackOnewayTest.java  | 12 ++++++++++++
 2 files changed, 23 insertions(+)

diff --git 
a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/DeliveryAssuranceOnewayTest.java
 
b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/DeliveryAssuranceOnewayTest.java
index 0477cdb7a8..054094adb6 100644
--- 
a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/DeliveryAssuranceOnewayTest.java
+++ 
b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/DeliveryAssuranceOnewayTest.java
@@ -76,6 +76,7 @@ public class DeliveryAssuranceOnewayTest extends 
AbstractBusClientServerTestBase
     private Endpoint endpoint;
     private Bus greeterBus;
     private Greeter greeter;
+    private ExecutorService executorService;
 
     @After
     public void tearDown() throws Exception {
@@ -89,6 +90,13 @@ public class DeliveryAssuranceOnewayTest extends 
AbstractBusClientServerTestBase
         } catch (Throwable t) {
             //ignore
         }
+        if (executorService != null) {
+            executorService.shutdown();
+            if (!executorService.awaitTermination(10, TimeUnit.SECONDS)) {
+                executorService.shutdownNow();
+            }
+            executorService = null;
+        }
         Thread.sleep(100);
     }
 
@@ -380,6 +388,9 @@ public class DeliveryAssuranceOnewayTest extends 
AbstractBusClientServerTestBase
 
         if (null != executor) {
             gs.setExecutor(executor);
+            if (executor instanceof ExecutorService) {
+                this.executorService = (ExecutorService) executor;
+            }
         }
 
         greeter = gs.getGreeterPort();
diff --git 
a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/MessageCallbackOnewayTest.java
 
b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/MessageCallbackOnewayTest.java
index 6d73c098c1..6f30dfc6f6 100644
--- 
a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/MessageCallbackOnewayTest.java
+++ 
b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/MessageCallbackOnewayTest.java
@@ -25,6 +25,7 @@ import java.util.HashSet;
 import java.util.Set;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
@@ -81,6 +82,7 @@ public class MessageCallbackOnewayTest extends 
AbstractBusClientServerTestBase {
     private Bus greeterBus;
     private Greeter greeter;
     private RecordingMessageCallback callback;
+    private ExecutorService executorService;
 
     @After
     public void tearDown() throws Exception {
@@ -94,6 +96,13 @@ public class MessageCallbackOnewayTest extends 
AbstractBusClientServerTestBase {
         } catch (Throwable t) {
             //ignore
         }
+        if (executorService != null) {
+            executorService.shutdown();
+            if (!executorService.awaitTermination(10, TimeUnit.SECONDS)) {
+                executorService.shutdownNow();
+            }
+            executorService = null;
+        }
     }
 
     @Test(timeout = 60000)
@@ -216,6 +225,9 @@ public class MessageCallbackOnewayTest extends 
AbstractBusClientServerTestBase {
 
         if (null != executor) {
             gs.setExecutor(executor);
+            if (executor instanceof ExecutorService) {
+                this.executorService = (ExecutorService) executor;
+            }
         }
 
         greeter = gs.getGreeterPort();

Reply via email to