Affects Version/s: None
Fix Version/s: None
The implementation of the two getKey() methods in gov.nist.javax.sip.stack.MessageChannel.java can cause a concurrency issue.
"public static String getKey(InetAddress inetAddr, int port, String transport)"
will return a string not containing the brackets , e.g. TCP:fd80::bdff:78b1:c4a8:26:5060.
The other method
"public static String getKey(HostPort hostPort, String transport)"
will return a string which contains brackets , e.g. TCP:[fd80::bdff:78b1:c4a8:26]:5060
Both methods are used by the TCPMessageProcessor and TLSMessageProcessor to create the TCPMessageChannel/TLSMessageChannel on demand.
Due to this problem two MessageProcessors will be created for the same key (the same remote address).
Together with a message channel a receiver thread will be created. So you will get the situation that you have two different receiver threads receiving messages from one socket. This will cause severe problems when a SIP message is received in two parts with two different TCP packets. The two received TCP packets may be handled by the two threads concurrently. It occurs, that the second half of the SIP message is handled before the first half which causes parser errors.
My suggestion is to remove potential brackets in both methods to guarantee to get the same key returned by both methods.
I've added a patch file for this.