[
https://issues.apache.org/jira/browse/CAMEL-24006?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Guillaume Nodet resolved CAMEL-24006.
-------------------------------------
Resolution: Fixed
> Fix flaky JpaPollingConsumerLockEntityTest
> ------------------------------------------
>
> Key: CAMEL-24006
> URL: https://issues.apache.org/jira/browse/CAMEL-24006
> Project: Camel
> Issue Type: Bug
> Reporter: Guillaume Nodet
> Assignee: Guillaume Nodet
> Priority: Major
> Labels: flaky-test
> Fix For: 4.22.0
>
>
> The JpaPollingConsumerLockEntityTest is flaky on CI. Develocity data over the
> last 10 days shows:
> - testPollingConsumerWithoutLock: 9 failures + 7 flaky out of 270 runs (5.9%)
> - testPollingConsumerWithLock: 0 failures + 15 flaky out of 270 runs (5.6%)
> The testPollingConsumerWithoutLock test relies on two concurrent JPA polling
> consumers racing to update the same versioned entity, expecting an
> OptimisticLockException. However, the race condition is not deterministic —
> sometimes one request completes before the other starts reading, so no
> conflict occurs.
> The fix uses a CyclicBarrier in the enrichment strategy to synchronize both
> threads after the read step, ensuring they both hold stale entity versions
> before either proceeds to write. This makes the conflict deterministic.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)