LengthFieldBasedFrameDecoder
mrochon
mattrochon at gmail.com
Wed Jun 23 11:44:37 EDT 2010
I use a length field based frame decoder with a small maximum message size
until a session is authenticated. I also have an authentication timeout to
turf clients that take too long to identify themselves.
It seems like the TooLongFrame exception only gets thrown once I close the
connection, not when the message intially comes in, even though the length
field value of the header is longer than the maximum message size.
Where I would expect the exception to be thrown immediately, my exception
handler is only fired when the connection gets closed.
[trace]
pool-2-thread-1 WARN [impl.XXXXXXXHandler] - An existing connection was
forcibly closed by the remote host
java.io.IOException: An existing connection was forcibly closed by the
remote host
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:25)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233)
at sun.nio.ch.IOUtil.read(IOUtil.java:206)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:236)
at
org.jboss.netty.buffer.HeapChannelBuffer.setBytes(HeapChannelBuffer.java:156)
at
org.jboss.netty.buffer.AbstractChannelBuffer.writeBytes(AbstractChannelBuffer.java:425)
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:305)
at
org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:275)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:196)
at
org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
pool-2-thread-1 INFO [impl.XXXXXXHandler] - disconnecting
client[/127.0.0.1:53363]
pool-2-thread-1 WARN [impl.XXXXXXHandler] - Adjusted frame length exceeds
28: 56
org.jboss.netty.handler.codec.frame.TooLongFrameException: Adjusted frame
length exceeds 28: 56
at
org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder.decode(LengthFieldBasedFrameDecoder.java:296)
.....
[/trace]
Is this the correct behaviour or am I doing something wrong?
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/LengthFieldBasedFrameDecoder-tp5213848p5213848.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list