This is an automated email from the ASF dual-hosted git repository.

apupier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new cb4b60637046 CAMEL-25348: stabilize LumberjackComponentTest using 
FixedLengthFrameDecoder for ACK framing
cb4b60637046 is described below

commit cb4b60637046ac383bdfc964160e4b57643a70ff
Author: AurĂ©lien Pupier <[email protected]>
AuthorDate: Thu Oct 15 14:31:32 2026 +0200

    CAMEL-25348: stabilize LumberjackComponentTest using
    FixedLengthFrameDecoder for ACK framing
    
    The test client's ACK recorder was vulnerable to both TCP coalescing
    (multiple 6-byte ACK frames arriving in one ByteBuf) and TCP
    fragmentation (one ACK split across two reads). Replace the raw
    SimpleChannelInboundHandler<ByteBuf> with a FixedLengthFrameDecoder(6)
    in front of it: Netty reassembles exactly one complete ACK frame per
    channelRead0 call, regardless of how TCP delivers the bytes.
    
    Signed-off-by: AurĂ©lien Pupier <[email protected]>
    Co-authored-by: IBM Bob 2.2.1
---
 .../java/org/apache/camel/component/lumberjack/LumberjackUtil.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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 71885d9b8ea8..b875c072864f 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
@@ -34,6 +34,7 @@ import io.netty.channel.ChannelPipeline;
 import io.netty.channel.SimpleChannelInboundHandler;
 import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.channel.socket.nio.NioSocketChannel;
+import io.netty.handler.codec.FixedLengthFrameDecoder;
 import io.netty.handler.ssl.SslHandler;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.support.jsse.SSLContextParameters;
@@ -74,7 +75,10 @@ final class LumberjackUtil {
                         pipeline.addLast(new SslHandler(sslEngine));
                     }
 
-                    // Add the response recorder
+                    // Each ACK frame is exactly 6 bytes: 1 version + 1 
type('A') + 4 sequence number.
+                    // FixedLengthFrameDecoder handles both TCP coalescing 
(multiple ACKs in one read)
+                    // and TCP fragmentation (one ACK split across multiple 
reads).
+                    pipeline.addLast(new FixedLengthFrameDecoder(6));
                     pipeline.addLast(new 
SimpleChannelInboundHandler<ByteBuf>() {
                         @Override
                         protected void channelRead0(ChannelHandlerContext ctx, 
ByteBuf msg) {

Reply via email to