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

reta pushed a commit to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit d7c142f4987475bd74cbb3f9f81878053fac14ff
Author: Guillaume Nodet <[email protected]>
AuthorDate: Thu Mar 26 20:19:47 2026 +0100

    Fix thread-safety bug in TestSpanHandler causing flaky tracing tests (#2971)
    
    * Increase Awaitility timeout in tracing tests from 5s to 10s
    
    The 5-second timeout introduced in #2962 is still not sufficient for
    CI environments under load. Tracing tests like
    testThatNewSpanIsCreatedOnClientTimeout continue to fail with
    ConditionTimeoutException at the 5-second mark. Increase all Awaitility
    timeouts to 10 seconds across all tracing test files.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    
    * Increase Awaitility timeout in tracing tests from 10s to 30s
    
    Even the 10s timeout was observed failing in CI (run 23065827441).
    Analysis of recent builds shows the 5s ConditionTimeoutException
    occurs in virtually every CI run. Use 30s to provide sufficient
    headroom for loaded CI environments while still catching genuine
    hangs.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    
    * Fix TestSpanHandler thread-safety and revert timeout increase
    
    TestSpanHandler.SPANS used a plain ArrayList, which is not
    thread-safe. Client and server spans are added from different
    threads, so concurrent ArrayList.add() calls can lose elements
    and size() may return stale values due to JMM visibility.
    
    Change to CopyOnWriteArrayList which provides proper thread-safety.
    Writes (span additions) are infrequent while reads (Awaitility
    polling) are frequent, making COW the ideal choice.
    
    Revert the Awaitility timeout back to 5s since the thread-safety
    fix addresses the root cause of the flaky failures.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
    
    ---------
    
    Co-authored-by: Claude Opus 4.6 <[email protected]>
    (cherry picked from commit e6ce6d62ce751883a032404efb8f179a8b9defd4)
---
 .../src/test/java/org/apache/cxf/systest/brave/TestSpanReporter.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/systests/tracing/src/test/java/org/apache/cxf/systest/brave/TestSpanReporter.java
 
b/systests/tracing/src/test/java/org/apache/cxf/systest/brave/TestSpanReporter.java
index d15fda52e0a..aac94ce787a 100644
--- 
a/systests/tracing/src/test/java/org/apache/cxf/systest/brave/TestSpanReporter.java
+++ 
b/systests/tracing/src/test/java/org/apache/cxf/systest/brave/TestSpanReporter.java
@@ -18,14 +18,14 @@
  */
 package org.apache.cxf.systest.brave;
 
-import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 import zipkin2.Span;
 import zipkin2.reporter.Reporter;
 
 public class TestSpanReporter implements Reporter<Span> {
-    private static final List<Span> SPANS = new ArrayList<>(12);
+    private static final List<Span> SPANS = new CopyOnWriteArrayList<>();
 
     @Override
     public void report(Span span) {

Reply via email to