Handling DecoderResult in HTTP Properly

14 views
Skip to first unread message

Asaf Mesika

unread,
Feb 23, 2019, 12:48:01 PM2/23/19
to Netty discussions
Hi,

I have question regarding the proper handling of HTTP requests.

I have the following pipeline:

channelPipeline.addLast(new HttpRequestDecoder());
//...
channelPipeline.addLast(new HttpObjectAggregator(maxRequestBodySizeInBytes));
//...
channelPipeline.addLast(
new HttpDecoderResultValidator(httpProcessingMetrics));

In the result validator: 
I have the following check:

if (!request.decoderResult().isSuccess()) {


In that case, should I also call ReferenceCountUtil.release(msg);


If so, why? If not, why? 

I saw a fix in reactor-http project which led to think about it.

Without it there will be a memory leak?


Thanks!

Asaf

Norman Maurer

unread,
Feb 23, 2019, 12:49:43 PM2/23/19
to ne...@googlegroups.com
Yes you should as the message implements ReferenceCounted. If you fail to do so it may result in a leak.

Bye
Norman
--
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/3e87527a-14e4-45dd-ac6a-34db329e33d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages