SIP Router Project
FS#136 - tcp_async=yes breaks connect_timeout (no effect) and TCP reject detection
Opened by Iñaki Baz Castillo (ibc) - Wednesday, 15 June 2011, 09:47 GMT
Last edited by Daniel-Constantin Mierla (miconda) - Friday, 01 June 2012, 07:18 GMT
When using tcp_async=yes, tcp_connect_timeout has no effect at all. I set it to 3 seconds and try sending a request with RURI “sip:firstname.lastname@example.org:7777;transport=tcp”. The server 22.214.171.124 refuses the TCP connection (REJECT action in iptables rather than DROP), try yourself:
~# telnet 126.96.36.199 7777 Trying 188.8.131.52... telnet: Unable to connect to remote host: Connection refused
However when my Kamailio tries to open a TCP connection with such destination, it produces a local 408 after 30 seconds (fr_timer = 30000)!
Since Kamailio should detect that the TCP connection is rejected, I expect that it should generate an inmediate local 503 for the client transaction as RFC 3261 states.
I attach a file kamailio-tcp-reject.log which shows the issue. It clearly shows that tcp connection attemp fails inmediately (due to TCP reject) but it does not terminate the client transaction and instead it takes 30 seconds until it generates local 408:
Jun 15 12:40:51 kamailio: ERROR: <core> [tcp_main.c:4137]: connect 184.108.40.206:7777 failed
I’ve also tested sending a TCP INVITE to a host which is not reachable (220.127.116.11) so TCP timeouts occurs (after 5 seconds rather than 3 however...) but as in the other case, such TCP timeout does not terminate the client transaction and instead local 408 is generated after 30 seconds (I attach kamailio-tcp-timeout.log):
Jun 15 12:42:23 kamailio: DEBUG: <core> [io_wait.h:390]: DBG: io_watch_add(0x890f60, 18, 2, 0x7fae6c97d278), fd_no=10
If I set tcp_async=no, then the above issues don’t occur at all.
version: kamailio 3.2.0-dev5 (x86_64/linux) 552425