directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Therning <nik...@trillian.se>
Subject [mina] Bug in VmPipeFilter
Date Wed, 23 Nov 2005 19:17:00 GMT
Hi,

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.

/Niklas


Mime
View raw message