mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sven Panko <Sven.Pa...@proximity.de>
Subject Re: Problem with IoHandler messageSent/messageReceived
Date Fri, 15 Sep 2006 07:49:04 GMT
Hi Trustin,

I did some further investigation last night to narrow the problem. Shame 
on me, the second part of my problem (a final message in a communication 
session wasn't delivered until a new package was sent) was due to a really 
nasty bug in my code which took me three hours to detect - I hope you 
don't mind.

As for my first observation (messageSent/messageReceived is called more 
than once): this one is still reproducible with a slight modification (see 
below). I created a tiny little sample program attached to this mail which 
(apart from some slight modifications) contains the 
encoder/decoder/IoHandler implementation I use. It was compiled with Java 
5 (Update 8) and against mina 0.9.5 (running on Win XP SP2). When you 
start the server and afterwards the client you see, that the server 
receives every packet one time (this is different from my first report - 
messageReceived seems to behave correctly). When you look at the sysout 
statements from the client you will see, that messageSent is called twice 
(on my machine) for each string it is sending over.

Maybe the problem is related to the fact that I chose to send every packet 
as a header (8 bytes), followed by one or more "packets" with a size of 
2KB at maximum. Since the strings are rather short (23 and 130 bytes) I 
invoke out.write() twice for each packet (first the header and afterwards 
the payload) - and I get two calls to messageSent(). In a real-case 
scenario on our product I sent a packet of nearly 5000 byte(s), which 
invoked messageSent four times - exactly like my code called out.write 
(header, 2 x 2048byte packets, 904 byte packet). What is strange at that 
point is that messageSent() each time contains the whole message as being 
the data that was sent instead of only the partial packets I put into the 
byte buffer and "sent" via out.write()...

Hope that helps and thanks for your time,

Sven




"Trustin Lee" <trustin@gmail.com> wrote on 15.09.2006 05:11:34:

> Hello Sven,
> 
> To summarize your problem:
> 
> 1. messageReceived (or messageSent) is fired more than once for one 
message.
> 2. messageReceived event sometimes contain ehe message sent to the 
remote
> peer.
> 
> Is this correct?
> 
> Fixing this kind of problem is not really easy until you provide a
> reproduceable JUnit test case or very easy step-by-step instruction. 
Could
> you please do that for us?
> 
> Another option could be upgrading to the latest snapshot in our SVN
> repository, but there's no essential difference in event handling 
between
> 0.9.5 and trunk.
> 
> Trustin
> -- 
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP key fingerprints:
> * E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
> * B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6



Information contained in this message is confidential and may be legally privileged. If you
are not the addressee indicated in this message (or responsible for the delivery of the message
to such person), you may not copy, disclose or deliver this message or any part of it to anyone,
in any form. In such case, you should delete this message and kindly notify the sender by
reply Email. Opinions, conclusions and other information in this message that do not relate
to the official business of Proximity shall be understood as neither given nor endorsed by
it.
Mime
View raw message