You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "atiaomar1978-hub (via GitHub)" <gi...@apache.org> on 2026/08/05 03:06:35 UTC

[PR] CAMEL-24024: Harden InOutQueueProducerAsyncLoadTest against CI flakes [camel]

atiaomar1978-hub opened a new pull request, #25333:
URL: https://github.com/apache/camel/pull/25333

   ## Summary
   
   Fixes [CAMEL-24024](https://issues.apache.org/jira/browse/CAMEL-24024): `InOutQueueProducerAsyncLoadTest` is flaky in CI under load.
   
   The core fix (500 messages, `CountDownLatch`, `AtomicInteger` failure tracking) was merged as [CAMEL-24027](https://issues.apache.org/jira/browse/CAMEL-24027) in #24626. This PR addresses remaining flake sources:
   
   - **Inflight race:** poll with Awaitility until `context.getInflightRepository().size()` is 0 instead of asserting immediately after executor shutdown
   - **JMS listener thread:** replace `fail()` in `onMessage` with `AtomicInteger` error tracking (JUnit `fail()` from a JMS callback thread is unreliable)
   - **Executor lifecycle:** wrap submission/wait in `try/finally` so shutdown always runs
   - **Null-safe cleanup:** guard `MessageProducer.close()` when no message was processed
   - Drop unnecessary `public` modifiers per JUnit 5 conventions
   
   ## Test plan
   
   - [x] `./mvnw -pl components/camel-sjms -am test -Dtest=InOutQueueProducerAsyncLoadTest`
   
   ---
   _AI-generated PR description on behalf of atiaomar1978-hub_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24024: Harden InOutQueueProducerAsyncLoadTest against CI flakes [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #25333:
URL: https://github.com/apache/camel/pull/25333#issuecomment-5187833936

   <!-- ci-tested-modules -->
   :test_tube: **CI tested the following changed modules:**
   
   - `components/camel-sjms`
   
   ---
   
   <details><summary>:microscope: Scalpel shadow comparison — Scalpel: 1 tested, 0 compile-only — current: 11 all tested</summary>
   
   [Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **1 affected modules** (current approach: 11).
   
   <details><summary>Modules only in current approach (10)</summary>
   
   - `camel-jbang-mcp`
   - `camel-jbang-plugin-mcp`
   - `camel-jbang-plugin-route-parser`
   - `camel-jbang-plugin-tui`
   - `camel-jbang-plugin-validate`
   - `camel-launcher-container`
   - `camel-mllp`
   - `camel-sjms2`
   - `camel-yaml-dsl-validator`
   - `camel-yaml-dsl-validator-maven-plugin`
   
   </details>
   
   **Skip-tests mode would test 1 modules** (1 direct + 0 downstream), **skip tests for 0** (generated code, meta-modules)
   
   <details><summary>Modules Scalpel would test (1)</summary>
   
   - `camel-sjms`
   
   </details>
   
   > :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
   
   </details>
   
   <details><summary>All tested modules (11 modules)</summary>
   
   - Camel :: JBang :: MCP
   - Camel :: JBang :: Plugin :: MCP
   - Camel :: JBang :: Plugin :: Route Parser
   - Camel :: JBang :: Plugin :: TUI
   - Camel :: JBang :: Plugin :: Validate
   - Camel :: Launcher :: Container
   - Camel :: MLLP
   - Camel :: Simple JMS
   - Camel :: Simple JMS2
   - Camel :: YAML DSL :: Validator
   - Camel :: YAML DSL :: Validator Maven Plugin
   
   </details>
   
   ---
   :gear: [View full build and test results](https://github.com/apache/camel/actions/runs/30971495012)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24024: Harden InOutQueueProducerAsyncLoadTest against CI flakes [camel]

Posted by "atiaomar1978-hub (via GitHub)" <gi...@apache.org>.
atiaomar1978-hub commented on PR #25333:
URL: https://github.com/apache/camel/pull/25333#issuecomment-5187088615

   ## Fix summary
   
   Addresses [CAMEL-24024](https://issues.apache.org/jira/browse/CAMEL-24024) — flaky `InOutQueueProducerAsyncLoadTest` in CI.
   
   **Context:** Core fix (500 msgs, `CountDownLatch`, failure counter) landed as [CAMEL-24027](https://issues.apache.org/jira/browse/CAMEL-24027) / #24626. This PR hardens remaining flake sources.
   
   **Changes:**
   - Poll with Awaitility until inflight repository is drained (async route lag)
   - Track JMS listener errors via `AtomicInteger` instead of `fail()` from callback thread
   - `try/finally` for executor shutdown; termination assert outside `finally`
   - Catch `Throwable` in worker threads so assertion failures are counted
   - Null-safe `MessageProducer.close()`, named timeout constants
   
   **Verified:**
   ```bash
   ./mvnw -pl components/camel-sjms -am test -Dtest=InOutQueueProducerAsyncLoadTest
   ```
   
   ---
   _AI-generated comment on behalf of atiaomar1978-hub_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24024: Harden InOutQueueProducerAsyncLoadTest against CI flakes [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #25333:
URL: https://github.com/apache/camel/pull/25333#issuecomment-5187723511

   :star2: Thank you for your contribution to the Apache Camel project! :star2:
     :robot: CI automation will test this PR automatically.
   
     :camel: Apache Camel Committers, please review the following items:
   
     * First-time contributors **require MANUAL approval** for the GitHub Actions to run
     * You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
     * You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
     * Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
     
     :warning: Be careful when sharing logs. Review their contents before sharing them publicly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24024: Harden InOutQueueProducerAsyncLoadTest against CI flakes [camel]

Posted by "atiaomar1978-hub (via GitHub)" <gi...@apache.org>.
atiaomar1978-hub commented on PR #25333:
URL: https://github.com/apache/camel/pull/25333#issuecomment-5187088715

   ## Review follow-up (BugBot + Grok)
   
   | Finding | Action |
   |---|---|
   | **Grok High:** `catch (Exception)` swallows `AssertionError` | Changed to `catch (Throwable)` |
   | **Grok Medium:** `assertTrue` in `finally` masks primary failure | Moved `awaitTermination` assert outside `finally` |
   | **Grok Medium:** shared JMS session across listeners | Pre-existing design; not changed in this PR |
   | **BugBot** | No findings in this test file (unrelated TUI diff on fork main) |
   
   Re-verified: `InOutQueueProducerAsyncLoadTest` passes locally.
   
   ---
   _AI-generated comment on behalf of atiaomar1978-hub_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24024: Harden InOutQueueProducerAsyncLoadTest against CI flakes [camel]

Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #25333:
URL: https://github.com/apache/camel/pull/25333#discussion_r3718148416


##########
components/camel-sjms/src/test/java/org/apache/camel/component/sjms/producer/InOutQueueProducerAsyncLoadTest.java:
##########
@@ -70,43 +74,42 @@ public void cleanupConsumers() throws JMSException {
 
     /**
      * Test to verify that when using the consumer listener for the InOut producer we get the correct message back.
-     *
-     * @throws Exception
      */
     @Test
-    public void testInOutQueueProducer() throws Exception {
-        final int messageCount = 500;
-        final CountDownLatch latch = new CountDownLatch(messageCount);
+    void testInOutQueueProducer() throws Exception {
+        final CountDownLatch latch = new CountDownLatch(MESSAGE_COUNT);
         final AtomicInteger failures = new AtomicInteger();
 
         ExecutorService executor = Executors.newFixedThreadPool(2);
-
-        for (int i = 1; i <= messageCount; i++) {
-            final int tempI = i;
-            executor.execute(() -> {
-                try {
-                    final String requestText = "Message " + tempI;
-                    final String responseText = "Response Message " + tempI;
-                    String response = template.requestBody("direct:start", requestText, String.class);
-                    assertNotNull(response);
-                    assertEquals(responseText, response);
-                } catch (Exception e) {
-                    failures.incrementAndGet();
-                    log.error("Failed to process message {}", tempI, e);
-                } finally {
-                    latch.countDown();
-                }
-            });
+        try {
+            for (int i = 1; i <= MESSAGE_COUNT; i++) {
+                final int tempI = i;
+                executor.execute(() -> {
+                    try {
+                        final String requestText = "Message " + tempI;
+                        final String responseText = "Response Message " + tempI;
+                        String response = template.requestBody("direct:start", requestText, String.class);
+                        assertNotNull(response);
+                        assertEquals(responseText, response);
+                    } catch (Throwable e) {

Review Comment:
   **[Low — style]** `catch (Throwable e)` is slightly broader than necessary. Since the intent is to catch both `Exception` (from `requestBody`) and `AssertionError` (from `assertNotNull`/`assertEquals`), using a multi-catch would be more precise:
   
   ```suggestion
                       } catch (Exception | AssertionError e) {
   ```
   
   Functionally equivalent here since the error is tracked via `failures`, so not blocking — just a minor precision improvement.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24024: Harden InOutQueueProducerAsyncLoadTest against CI flakes [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #25333:
URL: https://github.com/apache/camel/pull/25333


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org