Apache Directory Project - [mina] Bug in VmPipeFilter

This is Interesting: Free IT Magazines  
Home > Archive > Apache Directory Project > November 2005 > [mina] Bug in VmPipeFilter





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author [mina] Bug in VmPipeFilter
Niklas Therning

2005-11-23, 5:45 pm

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


Trustin Lee

2005-11-24, 7:45 am

Hi Niklas,

2005/11/24, Niklas Therning <niklas-8FIgwK2HfyIwFerOooGFRg@public.gmane.org>:
>
> 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/

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com