maxFrameLength in DelimiterBasedFrameDecoder and LengthFieldBasedFrameDecoder

이희승 (Trustin Lee) trustin at gmail.com
Tue Aug 16 04:57:45 EDT 2011


You are correct. You can either 1) detect such clients and disconnect them or 2) modify the decoder so that it raises an exception early (it's open source! :-))

-- 
Trustin Lee (http://gleamynode.net/)

On Sunday, August 14, 2011 at 11:07 PM, aaron.riekenberg wrote:

> I recently began using Netty after some experience with MINA and am
> appreciating the many useful encoder and decoder classes such as
> DelimiterBasedFrameDecoder and LengthFieldBasedFrameDecoder.
> 
> I have a question about the maxFrameLength parameter in both though. In
> DelimiterBasedFrameDecoder, if more the maxFrameLength bytes are read before
> finding a delimiter the code sets discardingTooLongFrame to true and
> continues reading until a delimiter is found. Once the delimiter is found
> it throws TooLongFrameException. Suppose the delimiter is never received. 
> In this case DelimiterBasedFrameDecoder will continue trying to read forever
> and will never throw an exception.
> 
> There is a TODO in the code saying it would be good to let the user choose
> when the exception is raised - initially when discardingTooLongFrame is set
> to true or later when the delimiter is found. In my situation I would
> prefer the first option - tell me immediately if the frame has grown too
> long so I can reset the connection, rather than waiting for a delimiter that
> may never come.
> 
> I think LengthFieldBasedFrameDecoder has this same issue (and it has the
> same TODO comment). It will always try to read the entire too-long frame
> before raising an exception. If the length field is set very large this
> could take an extremely long time or never happen.
> 
> --
> View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/maxFrameLength-in-DelimiterBasedFrameDecoder-and-LengthFieldBasedFrameDecoder-tp6684985p6684985.html
> Sent from the Netty User Group mailing list archive at Nabble.com (http://Nabble.com).
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org (mailto:netty-users at lists.jboss.org)
> https://lists.jboss.org/mailman/listinfo/netty-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20110816/1f516f82/attachment.html 


More information about the netty-users mailing list