showrav017 / jain-sip

Automatically exported from code.google.com/p/jain-sip
0 stars 0 forks source link

NIO TLS blocks on socket establishment for 10 seconds #115

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When trying to send message to destination that does not have established 
socket and is not reachable , sip stack gets blocking , thats because of usage 
of :
NioTcpMessageProcessor.blockingConnect

the exception posted below :
=========================================
javax.sip.TransactionUnavailableException: Could not resolve next hop or 
listening point unavailable!
        at gov.nist.javax.sip.SipProviderImpl.getNewClientTransaction(SipProviderImpl.java:449)
        at org.mobicents.slee.resource.sip11.SleeSipProviderImpl.getNewClientTransaction(SleeSipProviderImpl.java:431)
        at com.webukraine.ims.core.pcscf.NotificationProxySbb.onNOTIFY(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.mobicents.slee.runtime.sbbentity.SbbEntityImpl.invokeEventHandler(SbbEntityImpl.java:478)
        at org.mobicents.slee.runtime.eventrouter.routingtask.EventRoutingTaskImpl.routeQueuedEvent(EventRoutingTaskImpl.java:378)
        at org.mobicents.slee.runtime.eventrouter.routingtask.EventRoutingTaskImpl.run(EventRoutingTaskImpl.java:126)
        at org.mobicents.slee.runtime.eventrouter.EventRouterExecutorImpl$EventRoutingTaskStatsCollector.run(EventRouterExecutorImpl.java
:73)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:636)
Caused by: java.net.SocketTimeoutException
        at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:127)
        at gov.nist.javax.sip.stack.NioTcpMessageProcessor.initiateConnection(NioTcpMessageProcessor.java:70)
        at gov.nist.javax.sip.stack.NioTcpMessageProcessor.blockingConnect(NioTcpMessageProcessor.java:83)
        at gov.nist.javax.sip.stack.NIOHandler.createOrReuseSocket(NIOHandler.java:414)
        at gov.nist.javax.sip.stack.NioTcpMessageChannel.<init>(NioTcpMessageChannel.java:157)
        at gov.nist.javax.sip.stack.NioTlsMessageChannel.<init>(NioTlsMessageChannel.java:204)
        at gov.nist.javax.sip.stack.NioTlsMessageProcessor.createMessageChannel(NioTlsMessageProcessor.java:52)
        at gov.nist.javax.sip.stack.SIPTransactionStack.createMessageChannel(SIPTransactionStack.java:1685)
        at gov.nist.javax.sip.SipProviderImpl.getNewClientTransaction(SipProviderImpl.java:410)
        ... 13 more
=========================================

It should not block and allow the code proceed.
In case of socket establishment failure IOExceptionEvent may be thrown

Original issue reported on code.google.com by oifa.yul...@gmail.com on 14 May 2013 at 1:02

GoogleCodeExporter commented 8 years ago
Sorry , pointed to invalid function.

NioTcpMessageProcessor.initiateConnection has the following code :

socketChannel.socket().connect(address, timeout);
socketChannel.configureBlocking(false);

so first it tries to connect to other side and then configure blocking to false 
( non blocking )

Original comment by oifa.yul...@gmail.com on 14 May 2013 at 1:46

GoogleCodeExporter commented 8 years ago
Is there any workaround for this?

Original comment by beradrian on 14 Jan 2015 at 9:42