Netty 4.1.1 Chunked Protocol

89 views
Skip to first unread message

Mani Chaitanya

unread,
Jun 29, 2016, 12:50:21 PM6/29/16
to Netty discussions
When I upgraded the libraries from 4.0.19 to 4.1.1 version suddenly our tunnel client stopped working. We have a tunnel client which talks to the tunnel server (sends messages in chunked format) using netty channels with 4.0.19 libraries everything is working properly i.e when we send a request message from tunnel client to the tunnel server, server sends response which we print the number of bytes i.e 1000 bytes in our tunnel client but with 4.1.1 in our tunnel client it prints two 500 bytes messages. Nothing has changed on the tunnel server side.

The channelInbound handler used on the tunnel client when it receives the response from tunnel server will run in the below mentioned order

1. SslHandler
2. HttpResponseDecoder
3. HttpResponseLogger --> Here is the place where we print the number of bytes received.

Is there any changes happened in 4.1.1 which is causing this? Any help is pretty much appreciated.

Norman Maurer

unread,
Jun 29, 2016, 1:04:05 PM6/29/16
to ne...@googlegroups.com
Nothing I`m aware of… does it work with latest 4.0.x release ?


--
You received this message because you are subscribed to the Google Groups "Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netty+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netty/cc11ad1a-6cfd-4bab-a19e-ac439e6415ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Mani Chaitanya

unread,
Jun 29, 2016, 11:33:30 PM6/29/16
to Netty discussions
It does work till 4.0.19 but with latest releases from 4.0.20 to 4.1.1 it does not work for us.
Also I forgot to mention that we have used maxChunkSize of 131072 for HttpResponseDecoder.

Norman Maurer

unread,
Jun 30, 2016, 12:19:29 AM6/30/16
to ne...@googlegroups.com
Can you share some code?

Also can you share the code that setup the pipeline?

Mani Chaitanya

unread,
Jun 30, 2016, 8:44:38 AM6/30/16
to Netty discussions
Please find the below code which we use

pipeline.addLast("backendConnector", backendConnector); --> OutboundHandler used to connect to the tunnel server
pipeline.addLast("readHandler", responseReadHandler); --> InboundHandler which logs the incoming message
pipeline.addLast("requestHandler", requestHandler); --> OutboundHandler
pipeline.addLast("proxy", interceptorHandler); --> InboundHandler
   

   Below is the code snippet for the backendConnector outbound handler
       
   @Override
   public synchronized void write(final ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
                throws Exception {
            connectWithRetry(ctx, tunnelServerHost, tunnelServerPort, 3, new ChannelFutureListener(){
                public void operationComplete(final ChannelFuture future) throws Exception {
                    if (future.isSuccess()) {
                        ChannelPipeline pipeline = ctx.pipeline();
              
                        pipeline.addFirst("decode", new HttpResponseDecoder(4096, 8192, 131072));
                        pipeline.addFirst("encode", new HttpRequestEncoder());
                        //creating a sslHandler
                        pipeline.addFirst("ssl", sslHandler);
                        //custome code here
                    } else {
                        closeChannel("Failed to connect to backend channel", future);
                    }
                }
            });
Message has been deleted

Mani Chaitanya

unread,
Jul 3, 2016, 1:28:25 AM7/3/16
to Netty discussions
I have posted the sample code in my previous post could you please take a look. Also below are my observation for HttpResponseDecoder

1. In 4.0.19 HttpResponseDecoder extends HttpObjecDecoder and HttpObjectDecoder extends Replyaing Decoder but in 4.1.1 HttpObjecDecoder extends ByteToMessageDecoder.
2. There are some code differences between 4.0.19 and 4.1.1 for HttpResponseDecoder.

would the above changes causing this issue?

Ian Barfield

unread,
Jul 7, 2016, 12:17:25 PM7/7/16
to Netty discussions

I would focus your comparisons on 4.0.20 to minimize the amount of irrelevant changes.


Reply all
Reply to author
Forward
0 new messages