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.
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); 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 so we changed it to session.close(false); 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) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:69) at sun.nio.ch.IOUtil.write(IOUtil.java:40) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334) at org.apache.mina.transport.socket.nio.NioProcessor.write(NioProcessor.java:28 7) at org.apache.mina.transport.socket.nio.NioProcessor.write(NioProcessor.java:44 ) at org.apache.mina.core.polling.AbstractPollingIoProcessor.writeBuffer(Abstract PollingIoProcessor.java:950) at org.apache.mina.core.polling.AbstractPollingIoProcessor.flushNow(AbstractPol lingIoProcessor.java:874) at org.apache.mina.core.polling.AbstractPollingIoProcessor.flush(AbstractPollin gIoProcessor.java:799) at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$700(AbstractP ollingIoProcessor.java:68) at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(Abstra ctPollingIoProcessor.java:1146) at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java: 64) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja va:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:9 08) at java.lang.Thread.run(Thread.java:662) 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. 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. Thanks in advance. Looking for concrete solution. Thanks And Regards, Nitin Phuria