<div>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! :-))<br></div>
<div><br>-- <br><a href="http://gleamynode.net/">Trustin Lee</a><br></div>
<p style="color: #A0A0A8;">On Sunday, August 14, 2011 at 11:07 PM, aaron.riekenberg wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<span><div><div>I recently began using Netty after some experience with MINA and am<br>appreciating the many useful encoder and decoder classes such as<br>DelimiterBasedFrameDecoder and LengthFieldBasedFrameDecoder.<br><br>I have a question about the maxFrameLength parameter in both though. In<br>DelimiterBasedFrameDecoder, if more the maxFrameLength bytes are read before<br>finding a delimiter the code sets discardingTooLongFrame to true and<br>continues reading until a delimiter is found. Once the delimiter is found<br>it throws TooLongFrameException. Suppose the delimiter is never received. <br>In this case DelimiterBasedFrameDecoder will continue trying to read forever<br>and will never throw an exception.<br><br>There is a TODO in the code saying it would be good to let the user choose<br>when the exception is raised - initially when discardingTooLongFrame is set<br>to true or later when the delimiter is found. In my situation I would<br>prefer the first option - tell me immediately if the frame has grown too<br>long so I can reset the connection, rather than waiting for a delimiter that<br>may never come.<br><br>I think LengthFieldBasedFrameDecoder has this same issue (and it has the<br>same TODO comment). It will always try to read the entire too-long frame<br>before raising an exception. If the length field is set very large this<br>could take an extremely long time or never happen.<br><br>--<br>View this message in context: <a href="http://netty-forums-and-mailing-lists.685743.n2.nabble.com/maxFrameLength-in-DelimiterBasedFrameDecoder-and-LengthFieldBasedFrameDecoder-tp6684985p6684985.html">http://netty-forums-and-mailing-lists.685743.n2.nabble.com/maxFrameLength-in-DelimiterBasedFrameDecoder-and-LengthFieldBasedFrameDecoder-tp6684985p6684985.html</a><br>Sent from the Netty User Group mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br>_______________________________________________<br>netty-users mailing list<br><a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/netty-users">https://lists.jboss.org/mailman/listinfo/netty-users</a><br></div></div></span>
</blockquote>
<div>
<br>
</div>