Hi Niklas,

2005/11/24, Niklas Therning <[EMAIL PROTECTED]>:
While writing a test for traffic control on VmPipe transports I may have
stumbled across a bug in VmPipeFilter. Basically I have an echo server
and a client which repeatedly sends a single byte to the server. When I
run this test I get an exception:

Exception in thread "IoThreadPool-1" java.lang.IllegalStateException:
Already released buffer.  You released the buffer too many times.
    at
org.apache.mina.common.ByteBuffer$DefaultByteBuffer.release (ByteBuffer.java:593)
    at
org.apache.mina.util.ByteBufferUtil.releaseIfPossible(ByteBufferUtil.java:43)
    at
org.apache.mina.filter.ThreadPoolFilter.processEvent(ThreadPoolFilter.java:616)
    at
org.apache.mina.filter.ThreadPoolFilter$Worker.processEvents (ThreadPoolFilter.java:372)
    at
org.apache.mina.filter.ThreadPoolFilter$Worker.run(ThreadPoolFilter.java:326)

I think this is because the ThreadPoolFilter releases buffers right
after it has called messageReceived/messageSent. Since VmPipeFilter
sends the same message object (i.e. the buffer) to these two methods the
ThreadPoolFilter will already have released the buffer when VmPipeFilter
calls nextFilter.messageReceived.

I have attached a simple application which demonstrates the bug. I've
also attached a fix to VmPipeFilter which also adds correct byte counts
if messages are buffers. Let me know if the fix looks ok and I will
check it in.

We could simply acquire the buffer once more?  WDYT?

You've got an access to the repository, so you can directly check it in. :)

Cheers,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/

Reply via email to