This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch 4.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/4.1.x-fixes by this push:
new e44bfff6bc7 Fix thread-safety bug in TestSpanHandler causing flaky
tracing tests (#2971)
e44bfff6bc7 is described below
commit e44bfff6bc7f63b561553d50da1f5fb3837226b7
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/TestSpanHandler.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git
a/systests/tracing/src/test/java/org/apache/cxf/systest/brave/TestSpanHandler.java
b/systests/tracing/src/test/java/org/apache/cxf/systest/brave/TestSpanHandler.java
index 266cc366379..86fc605add8 100644
---
a/systests/tracing/src/test/java/org/apache/cxf/systest/brave/TestSpanHandler.java
+++
b/systests/tracing/src/test/java/org/apache/cxf/systest/brave/TestSpanHandler.java
@@ -18,15 +18,15 @@
*/
package org.apache.cxf.systest.brave;
-import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
import brave.handler.MutableSpan;
import brave.handler.SpanHandler;
import brave.propagation.TraceContext;
public class TestSpanHandler extends SpanHandler {
- private static final List<MutableSpan> SPANS = new ArrayList<>(12);
+ private static final List<MutableSpan> SPANS = new
CopyOnWriteArrayList<>();
@Override
public boolean end(TraceContext context, MutableSpan span, Cause cause) {