[ 
https://issues.apache.org/jira/browse/CAMEL-24039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18121584#comment-18121584
 ] 

Guillaume Nodet commented on CAMEL-24039:
-----------------------------------------

This issue is being investigated by a coding agent (on behalf of gnodet).

The previous fix (PR #24639) increased the mock assertion timeout but did not 
address the root cause of the remaining flakiness in SedaAsyncProducerTest.

Root cause identified: race condition on the shared mutable *route* field. The 
test uses a non-volatile, non-synchronized String field mutated by both the 
test thread and the async executor thread. The delay(100ms) in the route is 
supposed to ensure ordering, but on loaded CI machines the test thread can be 
preempted for >100ms, causing the async thread to run first. Additionally, the 
read-modify-write on *route* is non-atomic.

Proposed fix: replace the shared String with an AtomicReference or 
ConcurrentLinkedQueue<String> and use proper synchronization to verify ordering.

_Note: This comment was generated by an AI coding agent and requires manual 
verification._

> Fix flaky core tests - seda, scheduler, and redelivery tests (batch 7)
> ----------------------------------------------------------------------
>
>                 Key: CAMEL-24039
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24039
>             Project: Camel
>          Issue Type: Test
>          Components: camel-core
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>            Priority: Major
>             Fix For: 4.22.0
>
>
> Several core tests are flaky because they use the deprecated 
> assertMockEndpointsSatisfied() method which has a default 10-second timeout 
> that can be too short on loaded CI systems.
> Affected tests:
> - NotAllowRedeliveryWhileStoppingDeadLetterChannelTest
> - NotAllowRedeliveryWhileStoppingTest
> - SedaMultipleConsumersTest
> - SedaAsyncProducerTest
> - TwoSchedulerConcurrentTasksOneRouteTest
> - TwoSchedulerConcurrentTasksTest
> - SchedulerRouteTest
> - SchedulerRepeatCountTest
> The fix replaces assertMockEndpointsSatisfied() with 
> MockEndpoint.assertIsSatisfied(context, 30, TimeUnit.SECONDS) to provide 
> explicit, generous timeouts.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to