Srikanth J a écrit :
Hi
I am facing a problem with tcp half-open connection.  Would really
appreciate any thoughts on the issue

The application uses mina tcp server (mina version - 1.1.7) with a
MLLP codec (MLLP codec is provided by apache-camel).  The problem is
that this application runs behind a hardware load balancer which does
a tcp half-open service ping to monitor if application is still
available.  The half-open involves load balancer sending a SYNC,
receiving the ACK from mina server, but not sending a ACK back (not
completing 3way hankshake) and then sending a Reset and FIN commands.
This is resulting in the following exception being thrown every time
half-open is done

org.apache.camel.CamelException: java.io.IOException: Connection reset
by peer (errno:232)
        at 
org.apache.camel.component.mina.MinaConsumer$ReceiveHandler.exceptionCaught(MinaConsumer.java:90)
        at 
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.exceptionCaught(AbstractIoFilterChain.java:564)
        at 
org.apache.mina.common.support.AbstractIoFilterChain.callNextExceptionCaught(AbstractIoFilterChain.java:345)
        at 
org.apache.mina.common.support.AbstractIoFilterChain.access$1000(AbstractIoFilterChain.java:53)
        at 
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.exceptionCaught(AbstractIoFilterChain.java:643)
        at 
org.apache.mina.common.IoFilterAdapter.exceptionCaught(IoFilterAdapter.java:75)
        at 
org.apache.mina.common.support.AbstractIoFilterChain.callNextExceptionCaught(AbstractIoFilterChain.java:345)
        at 
org.apache.mina.common.support.AbstractIoFilterChain.access$1000(AbstractIoFilterChain.java:53)
        at 
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.exceptionCaught(AbstractIoFilterChain.java:643)
        at 
org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:224)
        at 
org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at 
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
        at java.lang.Thread.run(Thread.java:595)
Caused by: java.io.IOException: Connection reset by peer (errno:232)
        at sun.nio.ch.FileDispatcher.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:21)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233)
        at sun.nio.ch.IOUtil.read(IOUtil.java:200)
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:207)
        at 
org.apache.mina.transport.socket.nio.SocketIoProcessor.read(SocketIoProcessor.java:218)
        at 
org.apache.mina.transport.socket.nio.SocketIoProcessor.process(SocketIoProcessor.java:198)
        at 
org.apache.mina.transport.socket.nio.SocketIoProcessor.access$400(SocketIoProcessor.java:45)
        at 
org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:485)
        ... 2 more

Is this a known issue (i did look up the mail archive and did some
googling, dint find much) or is this happening because of any possible
wrong configuration of mina?

Sounds to me plain normal, as soon as the load balanced send a badly crafted message to the stack. You want your handler to know that the connection has been brutally terminated, in order to close the session and free all the resources you have allocated for this session, no ?

Check on the load balancer side to see if it can send something a bit smarter.

Another possibility would be to tune the MLLP codec to handle such a terminaison.

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


Reply via email to