I have threading issue when using TCP. The issue arrives when jain sip stack sends the 1st SIP out via SipDialog.sendRequest:
(a) thread#1 executes: sendTCPMessage which calls sendBytes (clientSock = null -> openOutgoingConnection) -> writeChunks -> send
In "NioTcpMessageProcessor.send" at then end it will execute: selector.wakeup
(b) thread#2 wakes up since it is on selector.select and will execute write. In the write method line #214 nioHandler.getMessageChannel will return null and thus have a 'Dead socketChannel'
(c) thread#1 returns in sendTCPMessage and since sock != socketChannel 1st time it will excute:
nioHandler.putMessageChannel(sock, this);
But then this is too late. The 1st SipDialog.sendRequest is not sent out & the stack does not even retry because it does not detect this as a failure.
I have added myself a stack trace in the putMessageChannel to confirm that this is what happens.
siptcperror.log
I have threading issue when using TCP. The issue arrives when jain sip stack sends the 1st SIP out via SipDialog.sendRequest:
(a) thread#1 executes: sendTCPMessage which calls sendBytes (clientSock = null -> openOutgoingConnection) -> writeChunks -> send
In "NioTcpMessageProcessor.send" at then end it will execute: selector.wakeup
(b) thread#2 wakes up since it is on selector.select and will execute write. In the write method line #214 nioHandler.getMessageChannel will return null and thus have a 'Dead socketChannel'
(c) thread#1 returns in sendTCPMessage and since sock != socketChannel 1st time it will excute:
nioHandler.putMessageChannel(sock, this);
But then this is too late. The 1st SipDialog.sendRequest is not sent out & the stack does not even retry because it does not detect this as a failure.
I have added myself a stack trace in the putMessageChannel to confirm that this is what happens.
siptcperror.log