Thanks a ton for lightning fast reply and concrete suggestions on the
problem shared. You mentioned that we should start using MINA V2.0.7 as many
bugs are been fixed from V2.0.4 I presume I can simply replace the MINA Core
Jar from V2.0.4 to V2.0.7, pls confirm.

Thanks And Regards,
Nitin Phuria

-----Original Message-----
From: Emmanuel Lécharny [mailto:elecha...@gmail.com] 
Sent: Tuesday, November 19, 2013 6:54 PM
To: users@mina.apache.org
Subject: Re: MINA: How to close the sessions with MINA

Le 11/19/13 1:59 PM, Nitin a écrit :
> Dear All,
>
>       We have developed one server using Apache MINA V2.0.4 where multiple
> vendors connect and send the messages which needs to be processed and then
> response have to be sent back to vendor. Currently we have put a strategy
> that vendor has to send one message per connection and after getting
> response or timeout vendor has to close the connection.

So far, so good.
>
>  
>
>       But after sometime we realized that some of the vendors are not
> closing connections and due that many sessions are remaining idle. To
tackle
> this we started using the sessionIdle(IoSession session, IdleStatus
status)
> event for each vendor connection and we use to close the session in this
> event with session.close(true); 

That's the right way to do it.

>
>  
>
> But then I saw this link where it was saying that session.close(true) may
> cause issue http://comments.gmane.org/gmane.comp.apache.mina.user/4616 

No.
>
> so we changed it to session.close(false); 

Wrong. It will wait for all the pending messages to be sent to the
(vanished) client. That means forever.
>
>  
>
> Now we are facing issue of Broken pipes. Suddenly we start getting below
> ERROR and it will keep coming continuously and fills the log files only
with
> this error.
>
>  
>
> java.io.IOException: Broken pipe
>
>       at sun.nio.ch.FileDispatcher.write0(Native Method)

It's plain normal : the server is trying to send messages to a now
disconnected server. And it will try again and again.
>
>
> We have observed that once above issue comes we end up in restarting our
> MINA based server or sometimes the OS to bring it back to working state.
Yes.

>
> I would like to know in details how I can identify the idle session and
with
> our strategy of one message per connection how we can identify the idle
> sessions and close them peacefully. 

Again, just do what you suggested : manage the sessionIdle() event and
do close(true) (ie, clise with imediate effect, discarding the pending
messages).


>
>  
>
> Thanks in advance. Looking for concrete solution.
close(true) and sessionIdle managed is a concrete solution to your
problem. Don't read threads and deduce that there is a problem. If you
have an issue with close(true) and idle management, then please post on
this mailing list so that we can help you with valid solutions.


Ah, btw, I urge you to switch to 2.0.7. 2.0.4 is more than 2 years old,
and many bugs have been fixed since.

Thnks for using MINA !


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

Reply via email to