This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch quick-fix/lumberjack-multithread-it-flakiness in repository https://gitbox.apache.org/repos/asf/camel.git
commit 342ade07acb8b46727363b6acd0750ccc69d37cd Author: Claus Ibsen <[email protected]> AuthorDate: Thu Aug 27 07:42:56 2026 +0200 chore: camel-lumberjack - fix flaky LumberjackMultiThreadIT LumberjackMultiThreadIT.shouldListenToMessages only waited 5 seconds on a CountDownLatch for all client threads to finish, but LumberjackUtil.sendMessages() waits up to 30 seconds internally for ACKs. Under load a thread could legitimately take longer than 5s, causing the latch wait to time out intermittently. - Widen the latch wait to 35s so it exceeds the internal 30s ACK-wait ceiling with margin. - Reduce client-side thread oversubscription: each client thread created its own NioEventLoopGroup with the default thread count (2x available processors); with up to 4 concurrent client threads this could oversubscribe CPU on constrained CI runners. Changed to NioEventLoopGroup(1) since each client only manages a single channel. Co-Authored-By: Claude Sonnet 5 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../apache/camel/component/lumberjack/LumberjackMultiThreadIT.java | 6 +++++- .../java/org/apache/camel/component/lumberjack/LumberjackUtil.java | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackMultiThreadIT.java b/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackMultiThreadIT.java index 97dd9c34d6b8..ae8d51fdd188 100644 --- a/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackMultiThreadIT.java +++ b/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackMultiThreadIT.java @@ -80,7 +80,11 @@ public class LumberjackMultiThreadIT extends CamelTestSupport { mock.expectedMessageCount(25 * CONCURRENCY_LEVEL); mock.allMessages().body().isInstanceOf(Map.class); - final boolean await = latch.await(5, TimeUnit.SECONDS); + // LumberjackUtil.sendMessages() waits up to 30 seconds internally for ACKs before a thread + // counts down the latch (that 30s bound was itself raised from Awaitility's 10s default in + // 5df5b4719ac1 to fix flakiness on loaded CI runners). This wait must exceed 30s with margin, + // or a thread that legitimately takes close to the internal max would trip this latch first. + final boolean await = latch.await(35, TimeUnit.SECONDS); assertTrue(await, "All threads should have sent their messages by now"); // Then we should have the messages we're expecting diff --git a/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackUtil.java b/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackUtil.java index 06008beff30c..92314c7b6543 100644 --- a/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackUtil.java +++ b/components/camel-lumberjack/src/test/java/org/apache/camel/component/lumberjack/LumberjackUtil.java @@ -54,7 +54,9 @@ final class LumberjackUtil { static List<Integer> sendMessages( int port, SSLContextParameters sslContextParameters, List<Integer> windows, boolean waitForResult) throws InterruptedException { - NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup(); + // A single thread is enough for one client connection; avoids oversubscribing CPU when + // multiple client threads each spin up their own group (default is 2x available processors). + NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup(1); try { // This list will hold the acknowledgment response sequence numbers List<Integer> responses = new ArrayList<>();
