I guess your decoder implementation has a bug.  Please make sure that
you have enough data in your buffer before reading something.  You have
to return NEED_DATA if there's not enough data in the buffer.

HTH,

On Thu, 2008-03-20 at 00:59 +0900, Abhijit Bhatode wrote:
> Hi,
> 
> I am using MINA 1.1. My MINA server randomly throws
> java.nio.BufferUnderflowException.
> Below are the server logs.
> 
> 11579 [AnonymousIoService-11] WARN  ObIoHandler  - [/10.77.199.57:3626]
> EXCEPTION:
> org.apache.mina.filter.codec.ProtocolDecoderException:
> java.nio.BufferUnderflowException (Hexdump: 00)
>       at
> org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCod
> ecFilter.java:165)
>       at
> org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived
> (AbstractIoFilterChain.java:299)
>       at
> org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoF
> ilterChain.java:53)
>       at
> org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageRece
> ived(AbstractIoFilterChain.java:648)
>       at
> org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.j
> ava:220)
>       at
> org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(Exe
> cutorFilter.java:264)
>       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
> Source)
>       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
> Source)
>       at
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:
> 51)
>       at java.lang.Thread.run(Unknown Source)
> Caused by: java.nio.BufferUnderflowException
>       at java.nio.Buffer.nextGetIndex(Unknown Source)
>       at java.nio.HeapByteBuffer.getInt(Unknown Source)
>       at
> org.apache.mina.common.support.BaseByteBuffer.getInt(BaseByteBuffer.java:277
> )
>       at com.netlib.ObMessageDecoder.doDecode(ObMessageDecoder.java:22)
>       at
> org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(CumulativeProt
> ocolDecoder.java:133)
>       at
> org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCod
> ecFilter.java:158)
>       ... 9 more
> 11579 [AnonymousIoService-11] WARN  ObIoHandler  - [/10.77.199.57:3626]
> EXCEPTION, please implement com.netlib.ObIoHandler.exceptionCaught() for
> proper handling:
> org.apache.mina.filter.codec.ProtocolDecoderException:
> java.nio.BufferUnderflowException (Hexdump: 00)
>       at
> org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCod
> ecFilter.java:165)
>       at
> org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived
> (AbstractIoFilterChain.java:299)
>       at
> org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoF
> ilterChain.java:53)
>       at
> org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageRece
> ived(AbstractIoFilterChain.java:648)
>       at
> org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.j
> ava:220)
>       at
> org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(Exe
> cutorFilter.java:264)
>       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
> Source)
>       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
> Source)
>       at
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:
> 51)
>       at java.lang.Thread.run(Unknown Source)
> Caused by: java.nio.BufferUnderflowException
>       at java.nio.Buffer.nextGetIndex(Unknown Source)
>       at java.nio.HeapByteBuffer.getInt(Unknown Source)
>       at
> org.apache.mina.common.support.BaseByteBuffer.getInt(BaseByteBuffer.java:277
> )
>       at com.netlib.ObMessageDecoder.doDecode(ObMessageDecoder.java:22)
>       at
> org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(CumulativeProt
> ocolDecoder.java:133)
>       at
> org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCod
> ecFilter.java:158)
>       ... 9 more
> 11579 [AnonymousIoService-11] DEBUG ExecutorFilter  - Exiting since queue is
> empty for /10.77.199.57:3626
> 
> 
> Thanks & Regards,
> Abhijit
> 
> 
> _____________________________________________
> From: Abhijit Bhatode [mailto:[EMAIL PROTECTED] 
> Sent: Monday, March 17, 2008 6:47 PM
> To: '[email protected]'
> Subject: Using low level socket calls with MINA
> 
> Hi,
> 
> My application requires that some messages be sent or received without the
> application protocol being used. 
> Is there any way so that I can use low level socket calls directly for these
> messages, as these do not follow the standard protocol followed by the
> application?
> I am using MINA version 1.1
> 
> Thanks & Regards,
> Abhijit
> 
> 
> 
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which is the 
> property of Persistent Systems Ltd. It is intended only for the use of the 
> individual or entity to which it is addressed. If you are not the intended 
> recipient, you are not authorized to read, retain, copy, print, distribute or 
> use this message. If you have received this communication in error, please 
> notify the sender and delete all copies of this message. Persistent Systems 
> Ltd. does not accept any liability for virus infected mails.
-- 
Trustin Lee - Principal Software Engineer, JBoss, Red Hat
--
what we call human nature is actually human habit
--
http://gleamynode.net/

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to