You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Monajit Choudhury <mC...@sapient.com> on 2007/03/06 17:26:10 UTC

RE: .............org.apache.mina.common.BufferDataException: Object length should be greater than 4: 0

 
Hi
  I understand that and I apologize. But I got desperate. We are
embarking on this huge project and counting on MINA big time. But this
error was a big hurdle in designing the prototype. I need the support
from u guys as we go along . To give you an estimate of what MINA has to
go through is, it has to handle some 30 msgs per sec, listen
simultaneously to some 300 to 400 ports, and ve to b fast enough to
remain unnoticed as a proxy server. :).
 
 Regds
 Monajit

-----Original Message-----
From: Maarten Bosteels [mailto:mbosteels.dns@gmail.com] 
Sent: Tuesday, March 06, 2007 4:25 AM
To: dev@mina.apache.org
Subject: Re:
SOS!!!.............org.apache.mina.common.BufferDataException: Object
length should be greater than 4: 0

Monajit,

I am glad that you solved your problem.
But please note that using a subject that starts with
"SOS!!!............."
is not very polite and certainly does not guarantee a quicker response.

http://www.catb.org/~esr/faqs/smart-questions.html#bespecific

Maarten

On 3/5/07, Monajit Choudhury <mC...@sapient.com> wrote:
> Hi
>  I think I found where the problem is. Its not the problem with
serialization. After going through the codecs of the sumup example I
found that the whole object is not sent across.Only the primitive types
are encoded and passed along.Thats the reason when I do a
byteBuffer.getObject() I used to get a size 0 buffer.I modified the
codecs in the sumup example to pass the whole object and it worked.I
mean atleast I stopped getting the error :-).
> Regds
> Monajit
>
>
> -----Original Message-----
> From: Monajit Choudhury [mailto:mChoudhury@sapient.com]
> Sent: Mon 3/5/2007 4:39 PM
> To: dev@mina.apache.org
> Subject: RE:
SOS!!!.............org.apache.mina.common.BufferDataException: Object
length should be greater than 4: 0
>
>
> Thanks for the response Mark. Right now I am not worrying about the
latency.But what I want to avoid in doing in my proxy is serializing and
deserializing. I want to do that in a separate thread.The sumup client
is using a codec to serialize the object and the server deserializes
it.The proxy just acts as a tunnel.It forwards the resquests to the
server without any intervention and this model works.Even if I want to
add a codec into the proxy, where do I add it?
>
> -----Original Message-----
> From: Mark Webb [mailto:elihusmails@gmail.com]
> Sent: Mon 3/5/2007 4:08 PM
> To: dev@mina.apache.org
> Subject: Re:
SOS!!!.............org.apache.mina.common.BufferDataException: Object
length should be greater than 4: 0
>
> I have not worked much with serialization and mina, but I think you
need
> that codec to get things working.  My advice would be to get things
working,
> and then worry about latency/performance.
>
> On 3/5/07, Monajit Choudhury <mC...@sapient.com> wrote:
> >
> >
> > Not within the proxy. I am using the example proxy as is. We plan to
use
> > this proxy in the production system(after modifying it to handle
large
> > amount of traffic), so I wanted to  keep the latency to a minimum.I
dump
> > the whole byteBuffer in an async queue.Another thread goes thru the
queue
> > and deserializes the objects,and this is where it fails.
> >
> > Regds
> > Monajit
> >
> > -----Original Message-----
> > From: Mark Webb [mailto:elihusmails@gmail.com]
> > Sent: Mon 3/5/2007 3:52 PM
> > To: dev@mina.apache.org
> > Subject: Re:
> > SOS!!!.............org.apache.mina.common.BufferDataException:
Object length
> > should be greater than 4: 0
> >
> > Are you using a serialization codec ?
> >
> >
> > On 3/5/07, Monajit Choudhury <mC...@sapient.com> wrote:
> > > Hi Mark
> > >  Thanks a lot for your response. Still I am  getting the same
> > error.Hereis what I am doing now.
> > >
> > > public void onMessage(Message message) {
> > >                 // TODO we do the processing here. It might be the
we
> > link
> > the request recording stuffs here
> > >                 MessageObject bb =
> > (MessageObject)message.getMessageContent();
> > >         SimpleProtocolDecoderOutput pd = new
> > SimpleProtocolDecoderOutput(
> > bb.getSession(),null);
> > >
> > >         try {
> > >                         new
> >
ObjectSerializationCodecFactory().getDecoder().decode(bb.getSession(),
> > bb.getByteBuffer(), pd);
> > >                 } catch (Exception e2) {
> > >                         // TODO Auto-generated catch block
> > >                         e2.printStackTrace();
> > >                 }
> > >         pd.flush();
> > >         }
> > >
> > > The Message object wraps the ByteBuffer object within itself.The
size of
> > the stream is 0 and I think this is the problem. The client is able
to
> > receive the correct responses from the server via the proxy.This
means the
> > communication stream is working fine. I think I am not tapping the
right
> > stream.Any thoughts?
> > >
> > > Regds
> > > Monajit
> > >
> > >
> > > -----Original Message-----
> > > From: Mark Webb [mailto:elihusmails@gmail.com]
> > > Sent: Mon 3/5/2007 2:41 PM
> > > To: dev@mina.apache.org
> > > Subject: Re:
> > SOS!!!.............org.apache.mina.common.BufferDataException:
Object
> > length
> > should be greater than 4: 0
> > >
> > > Try this...
> > >
> > >
http://www.nabble.com/RE%3A-ObjectSerialization-problem-p7830060.html
> > >
> > >
> > > On 3/5/07, Monajit Choudhury <mC...@sapient.com> wrote:
> > > >
> > > > Hi
> > > > I am trying to mix the proxy example with the sumup example.So
all
> > client
> > > > requests in the in the sumup example goes via this proxy.In the
proxy
> > I
> > > > have a async queuing mechanism by which I dump the requests in a
queue
> > and
> > > > desirialize it in a separate thread.Now here is the problem...
> > > > This is the method in AbstractProxyIoHandler.
> > > > public void messageReceived( IoSession session, Object message )
> > throws
> > > > Exception
> > > >     {
> > > >
> > > >         ByteBuffer rb = ( ByteBuffer ) message;
> > > >         ByteBuffer wb = ByteBuffer.allocate( rb.remaining() );
> > > >         rb.mark();
> > > >         wb.put( rb );
> > > >         wb.flip();
> > > >         ServiceContext ctx = ServiceContext.getContext();
> > > >         Queue queue1 = (Queue) ctx.lookup("QM1.RecordingQ");
> > > >         Message msg = new MessageImpl(wb);
> > > >         queue1.pushIntoQueue(msg);
> > > >        ( ( IoSession ) session.getAttachment() ).write( wb );
> > > >         rb.reset();
> > > >         SessionLog.info( session, rb.getString(
CHARSET.newDecoder() )
> > );
> > > >     }
> > > >
> > > > Now when i deque the object and do a wb.getObject(), i get the
> > following
> > > > exception.
> > > > org.apache.mina.common.BufferDataException: Object length should
be
> > > > greater than 4: 0
> > > >
> > > > Instead of this, the client gets the response properly.I think
the
> > proxy
> > > > example was written to work with strings only. WHat changes do I
need
> > to
> > > > make in the proxy to make it work with Objects?Please HELP!!!!
> > > >
> > > >
> > > > Regds
> > > > Monajit
> > > >
> > >
> > >
> > >
> > > --
> > > ..Cheers
> > > Mark
> > >
> > >
> >
> >
> >
> > --
> > ..Cheers
> > Mark
> >
> >
>
>
> --
> ..Cheers
> Mark
>
>
>

Re: .............org.apache.mina.common.BufferDataException: Object length should be greater than 4: 0

Posted by Maarten Bosteels <mb...@gmail.com>.
Monajit,

Looking at the current http://mina.apache.org/testimonials.html
might help you to worry less about the performance of mina :-)

30 messages per second and 300-400 simultaneous connections
won't be a big problem for MINA itself, I guess.

Of course, it depends on the size of the messages, the complexity of
the protocol
and the logic that has to be done by 'the back-end'.

We can easily do 300 messages per second, and the botlleneck isn't MINA
but the (oracle) database. Other people have reported far more
impressive results with MINA.

regards,
Maarten





On 3/6/07, Emmanuel Lecharny <el...@gmail.com> wrote:
> On 3/6/07, Monajit Choudhury <mC...@sapient.com> wrote:
> >
> >
> > Hi
> >   I understand that and I apologize. But I got desperate. We are
> > embarking on this huge project and counting on MINA big time. But this
> > error was a big hurdle in designing the prototype. I need the support
> > from u guys as we go along . To give you an estimate of what MINA has to
> > go through is, it has to handle some 30 msgs per sec, listen
> > simultaneously to some 300 to 400 ports, and ve to b fast enough to
> > remain unnoticed as a proxy server. :).
>
>
>
> No problem at all, Monajit :)
>
> Sometime, it's good to be able to express desesperation... Next time, your
> message will be smoother, because :
> 1) you won't be so desesperate and,
> 2) you now know about the etiquette ;)
>
> Fell free to post mails to the list, it's always a pleasure (and also an
> advantage) to help users. The more problems users have, the more bug they
> found, the better will be the product and the documentation.
>
> Very glad that your problem has been solved :) Maybe you may consider to
> post a testimony when your project is over, to explain what you have used
> Mina for, and how you successfully implemented it. Mina team is very found
> of testimony (and of happy users, too :) !
>
> Emmanuel
>
>
> --
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>

Re: .............org.apache.mina.common.BufferDataException: Object length should be greater than 4: 0

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 3/6/07, Monajit Choudhury <mC...@sapient.com> wrote:
>
>
> Hi
>   I understand that and I apologize. But I got desperate. We are
> embarking on this huge project and counting on MINA big time. But this
> error was a big hurdle in designing the prototype. I need the support
> from u guys as we go along . To give you an estimate of what MINA has to
> go through is, it has to handle some 30 msgs per sec, listen
> simultaneously to some 300 to 400 ports, and ve to b fast enough to
> remain unnoticed as a proxy server. :).



No problem at all, Monajit :)

Sometime, it's good to be able to express desesperation... Next time, your
message will be smoother, because :
1) you won't be so desesperate and,
2) you now know about the etiquette ;)

Fell free to post mails to the list, it's always a pleasure (and also an
advantage) to help users. The more problems users have, the more bug they
found, the better will be the product and the documentation.

Very glad that your problem has been solved :) Maybe you may consider to
post a testimony when your project is over, to explain what you have used
Mina for, and how you successfully implemented it. Mina team is very found
of testimony (and of happy users, too :) !

Emmanuel


-- 
Cordialement,
Emmanuel Lécharny
www.iktek.com