Hi Emmanuel, On Thu, 03 Dec 2009 01:07:01 +0100, Emmanuel Lecharny <[email protected]> wrote:
> Alexander Christian a écrit : >> Hi guys, > <snip/> >> I've no idea what causes this bufferunderflow. And i've no idea how to >> track down the root of this issue (the stack does only show mina >> classes ..). > "Unchecked exception thrown when a relative get operation reaches the > source buffer's limit. " Basically, you try to do a get()on the IoBuffer > but there is nothing left into it. I know what a bufferunderflowexception is. Thanks. But 'til yesterday night I was not aware of "how to find the codeline that causes this problem". > Remember that you may perfectly receive your message in small pieces, > and you will have to reassemble them before being able to decode it. I'm aware of that. I tried a few things and finally found a solution for getting the root-cause of the problem: As it's an underflow exception and the stack shows a decode operation, it must be somewhere in a message-decoder class. So I added a try/catch for bufferunderflowexceptions to all relevant message-decoder classes. I think I finally found the codeline: I had a small message that just contained a String. I used the prefixedString thing to send the String. On decoder side I simply tried to read the prefixed String without waiting to have the complete message received. Now I know that reading this string is not blocking until enough data is available. So I always have to sent the size of the message-body along with the message to know on decoder-side how much bytes have to accumulate before reading/processing the message. br, Alex
