Skip to content

CAMEL-24024: Improve reliability of InOutQueueProducerAsyncLoadTest#24629

Open
gbhavya07 wants to merge 1 commit into
apache:mainfrom
gbhavya07:CAMEL-24024-fix-flaky-inout-test
Open

CAMEL-24024: Improve reliability of InOutQueueProducerAsyncLoadTest#24629
gbhavya07 wants to merge 1 commit into
apache:mainfrom
gbhavya07:CAMEL-24024-fix-flaky-inout-test

Conversation

@gbhavya07

Copy link
Copy Markdown
Contributor

Description

This PR addresses CAMEL-24024 by improving the reliability of InOutQueueProducerAsyncLoadTest, which was reported as flaky in CI due to high load and timeout-based synchronization.

Previously, the test submitted 5000 asynchronous requests using a 2-thread executor and relied on Awaitility to wait for executor termination. Under resource-constrained CI environments, the large workload could exceed the 30-second timeout, resulting in intermittent failures.

To make the test more deterministic while preserving its intent, this change:

  • Reduces the message count from 5000 to 500, which is sufficient to validate the asynchronous InOut request/reply behavior.
  • Replaces Awaitility-based polling with a CountDownLatch to reliably track completion of all submitted tasks.
  • Introduces an AtomicInteger to track asynchronous request failures and verifies that all requests complete successfully.

These changes preserve the purpose of the test while reducing its susceptibility to CI timing and resource constraints.

Target

  • I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (CAMEL-24024).

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.

  • I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.
    I ran mvn clean install -DskipTests from the project root. The build reached camel-kserve and failed due to an unrelated protobuf-maven-plugin/protoc generation error. The modified camel-sjms module builds successfully.

AI-assisted contributions

  • If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., Co-authored-by trailers) and the PR description identifies the AI tool used.

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix — the changes are well-reasoned and the test improvements are solid:

  • Message count 5000→500: Sufficient to validate async InOut behavior without overwhelming CI
  • CountDownLatch: Precise completion tracking instead of Awaitility polling on executor.isTerminated()
  • AtomicInteger failure tracking: Previously failures inside executor threads were silently swallowed — now they're caught and asserted
  • Lambda modernization and MESSAGE_COUNT constant: Clean readability improvements

Note: This PR overlaps with PR #24626 (gnodet, CAMEL-24027) which makes the same fix to the same test. The changes are nearly identical — only one should be merged. This PR uses 30s for both timeouts and a named constant for the message count; PR #24626 uses 60s for the latch and 10s for termination. Either approach works; the maintainer should pick one and close the other.

LGTM ✅

Claude Code review on behalf of @gnodet

@davsclaus

Copy link
Copy Markdown
Contributor

there is a merge conflict now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants