[ 
https://issues.apache.org/jira/browse/DIRMINA-1041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15433863#comment-15433863
 ] 

Emmanuel Lecharny commented on DIRMINA-1041:
--------------------------------------------

I have narrowed the problem to this stack trace :

{noformat}
org.apache.mina.core.RuntimeIoException: Failed to get the session.
        at 
org.apache.mina.core.future.DefaultConnectFuture.getSession(DefaultConnectFuture.java:68)
        at 
org.apache.mina.transport.socket.nio.DIRMINA1041Test.testWrite(DIRMINA1041Test.java:57)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
        at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
        at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.net.BindException: Can't assign requested address
        at sun.nio.ch.Net.connect0(Native Method)
        at sun.nio.ch.Net.connect(Net.java:454)
        at sun.nio.ch.Net.connect(Net.java:446)
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
        at 
org.apache.mina.transport.socket.nio.NioSocketConnector.connect(NioSocketConnector.java:185)
        at 
org.apache.mina.transport.socket.nio.NioSocketConnector.connect(NioSocketConnector.java:1)
        at 
org.apache.mina.core.polling.AbstractPollingIoConnector.connect0(AbstractPollingIoConnector.java:368)
        at 
org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:268)
        at 
org.apache.mina.core.service.AbstractIoConnector.connect(AbstractIoConnector.java:187)
        at 
org.apache.mina.transport.socket.nio.DIRMINA1041Test.testWrite(DIRMINA1041Test.java:50)
        ... 25 more
{noformat}

after 16300 loops. I don't get such a trace when I add a 2 ms sleep in the loop 
(at least, not always). Using a {{Thread.sleep(1)}} in the loop make the test 
to fail.

This 16300 number is pretty magic... Sounds like an OS limit.

> WriteFuture.await() hangs when the connection is closed remotely before await 
> is invoked
> ----------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-1041
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1041
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.13
>            Reporter: Gijsbert van den Brink
>         Attachments: DIRMINA1041Test.java
>
>
> When in a high throughput scenario a TCP connection is closed remotely before 
> one of the `await` methods on WriteFuture is invoked, the `await` method 
> hangs.
> We've actually been seeing this issue for quite some time in our production 
> environment in an application that uses Apache Camel with the camel-mina2 and 
> camel-hl7 components. I was finally able to reproduce the issue in a unit 
> test (see attached).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to