Re: [SR-Users] Kamailio connection issue

2020-03-04 Thread Denys Pozniak
Hello!
You can try to increase the debug printing level (like debug=2 or even
debug=3) and check syslog when Kamailio gets stuck.


ср, 4 мар. 2020 г. в 13:12, Tomas Zanet :

> Hi All,
>
> In these days I'm facing an issue or a misconfiguration, I don't know,
> with our remote apps (SIP clients) and our cloud server in which there's a
> Kamailio version 4.4.4.
> Sometimes our app takes some seconds (about 10-12sec) to connect to the
> Kamailio socket (sips on 5061) and our app is stuck on connect sytem call.
>
> To debug this behaviour I put a rule in the iptable like this:
> sudo iptables -I INPUT -p tcp -m tcp --dport 5061 -m state --state NEW  -j
> LOG --log-level 1 --log-prefix "New Connection "
>
> when everything goes well, there is one row which describes the new
> incoming connection Mar  4 07:08:40 server-xip-01 kernel: New Connection
> IN=eth0 OUT= MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 SRC=X.X.X.X
> DST=Y.Y.Y.Y LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP SPT=15819
> DPT=5061 WINDOW=65535 RES=0x00 CWR ECE SYN URGP=0
>
> when our app gets stuck in the connect, there are many attempts and seems
> that Kamailio is not ready to accept this connection:
> Mar  4 07:11:54 server-xip-01 kernel: New Connection IN=eth0 OUT=
> MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 SRC=X.X.X.X DST=Y.Y.Y.Y
> LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP SPT=52900 DPT=5061
> WINDOW=65535 RES=0x00 CWR ECE SYN URGP=0 Mar  4 07:11:54 server-xip-01
> kernel: New Connection IN=eth0 OUT=
> MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 SRC=X.X.X.X DST=Y.Y.Y.Y
> LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP SPT=52900 DPT=5061
> WINDOW=65535 RES=0x00 SYN URGP=0 Mar  4 07:11:55 server-xip-01 kernel: New
> Connection IN=eth0 OUT= MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00
> SRC=X.X.X.X DST=Y.Y.Y.Y LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP
> SPT=52900 DPT=5061 WINDOW=65535 RES=0x00 SYN URGP=0 Mar  4 07:11:55
> server-xip-01 kernel: New Connection IN=eth0 OUT=
> MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 SRC=X.X.X.X DST=Y.Y.Y.Y
> LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP SPT=52900 DPT=5061
> WINDOW=65535 RES=0x00 SYN URGP=0 Mar  4 07:11:55 server-xip-01 kernel: New
> Connection IN=eth0 OUT= MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00
> SRC=X.X.X.X DST=Y.Y.Y.Y LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP
> SPT=52900 DPT=5061 WINDOW=65535 RES=0x00 SYN URGP=0 Mar  4 07:11:56
> server-xip-01 kernel: New Connection IN=eth0 OUT=
> MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 SRC=X.X.X.X DST=Y.Y.Y.Y
> LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP SPT=52900 DPT=5061
> WINDOW=65535 RES=0x00 SYN URGP=0 Mar  4 07:11:56 server-xip-01 kernel: New
> Connection IN=eth0 OUT= MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00
> SRC=X.X.X.X DST=Y.Y.Y.Y LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP
> SPT=52900 DPT=5061 WINDOW=65535 RES=0x00 SYN URGP=0 Mar  4 07:11:56
> server-xip-01 kernel: New Connection IN=eth0 OUT=
> MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 SRC=X.X.X.X DST=Y.Y.Y.Y
> LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP SPT=52900 DPT=5061
> WINDOW=65535 RES=0x00 SYN URGP=0 Mar  4 07:11:58 server-xip-01 kernel: New
> Connection IN=eth0 OUT= MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00
> SRC=X.X.X.X DST=Y.Y.Y.Y LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP
> SPT=52900 DPT=5061 WINDOW=65535 RES=0x00 SYN URGP=0 Mar  4 07:12:00
> server-xip-01 kernel: New Connection IN=eth0 OUT=
> MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 SRC=X.X.X.X DST=Y.Y.Y.Y
> LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP SPT=52900 DPT=5061
> WINDOW=65535 RES=0x00 SYN URGP=0 Mar  4 07:12:05 server-xip-01 kernel: New
> Connection IN=eth0 OUT= MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00
> SRC=X.X.X.X DST=Y.Y.Y.Y LEN=48 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP
> SPT=52900 DPT=5061 WINDOW=65535 RES=0x00 SYN URGP=0 When it happens our app
> takes more than 10 sec to connect to the Kamailio socket.
>
> I tried to increase the children configuration parameter in the cfg file
> because I thought there were not enough tcp receiver but with no luck.
> Here are some configuration parameters:
>
> children = 16 // was 8 before found this issue
>
> # life time of TCP connection when there is no traffic # - a bit higher
> than registration expires to cope with UA behind NAT
> tcp_connection_lifetime=3605
>
> open_files_limit=8192
>
> tcp_max_connections=8192
> tls_max_connections=8192
>
> Here is the output of the ulimit command:
> ulimit -a
> core file size  (blocks, -c) 0
> data seg size   (kbytes, -d) unlimited
> scheduling priority (-e) 0
> file size   (blocks, -f) unlimited
> pending signals (-i) 31393
> max locked memory   (kbytes, -l) 64
> max memory size (kbytes, -m) unlimited
> open files  (-n) 65535
> pipe size(512 bytes, -p) 8
> POSIX message queues (bytes, -q) 819200
> real-time 

[SR-Users] Kamailio connection issue

2020-03-04 Thread Tomas Zanet
Hi All,

In these days I'm facing an issue or a misconfiguration, I don't know, with our 
remote apps (SIP clients) and our cloud server in which there's a Kamailio 
version 4.4.4.
Sometimes our app takes some seconds (about 10-12sec) to connect to the 
Kamailio socket (sips on 5061) and our app is stuck on connect sytem call.

To debug this behaviour I put a rule in the iptable like this:
sudo iptables -I INPUT -p tcp -m tcp --dport 5061 -m state --state NEW  -j LOG 
--log-level 1 --log-prefix "New Connection "

when everything goes well, there is one row which describes the new incoming 
connection Mar  4 07:08:40 server-xip-01 kernel: New Connection IN=eth0 OUT= 
MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 SRC=X.X.X.X DST=Y.Y.Y.Y LEN=64 
TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP SPT=15819 DPT=5061 WINDOW=65535 
RES=0x00 CWR ECE SYN URGP=0

when our app gets stuck in the connect, there are many attempts and seems that 
Kamailio is not ready to accept this connection:
Mar  4 07:11:54 server-xip-01 kernel: New Connection IN=eth0 OUT= 
MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 SRC=X.X.X.X DST=Y.Y.Y.Y LEN=64 
TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP SPT=52900 DPT=5061 WINDOW=65535 
RES=0x00 CWR ECE SYN URGP=0 Mar  4 07:11:54 server-xip-01 kernel: New 
Connection IN=eth0 OUT= MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 
SRC=X.X.X.X DST=Y.Y.Y.Y LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP 
SPT=52900 DPT=5061 WINDOW=65535 RES=0x00 SYN URGP=0 Mar  4 07:11:55 
server-xip-01 kernel: New Connection IN=eth0 OUT= 
MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 SRC=X.X.X.X DST=Y.Y.Y.Y LEN=64 
TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP SPT=52900 DPT=5061 WINDOW=65535 
RES=0x00 SYN URGP=0 Mar  4 07:11:55 server-xip-01 kernel: New Connection 
IN=eth0 OUT= MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 SRC=X.X.X.X 
DST=Y.Y.Y.Y LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP SPT=52900 
DPT=5061 WINDOW=65535 RES=0x00 SYN URGP=0 Mar  4 07:11:55 server-xip-01 kernel: 
New Connection IN=eth0 OUT= MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 
SRC=X.X.X.X DST=Y.Y.Y.Y LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP 
SPT=52900 DPT=5061 WINDOW=65535 RES=0x00 SYN URGP=0 Mar  4 07:11:56 
server-xip-01 kernel: New Connection IN=eth0 OUT= 
MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 SRC=X.X.X.X DST=Y.Y.Y.Y LEN=64 
TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP SPT=52900 DPT=5061 WINDOW=65535 
RES=0x00 SYN URGP=0 Mar  4 07:11:56 server-xip-01 kernel: New Connection 
IN=eth0 OUT= MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 SRC=X.X.X.X 
DST=Y.Y.Y.Y LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP SPT=52900 
DPT=5061 WINDOW=65535 RES=0x00 SYN URGP=0 Mar  4 07:11:56 server-xip-01 kernel: 
New Connection IN=eth0 OUT= MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 
SRC=X.X.X.X DST=Y.Y.Y.Y LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP 
SPT=52900 DPT=5061 WINDOW=65535 RES=0x00 SYN URGP=0 Mar  4 07:11:58 
server-xip-01 kernel: New Connection IN=eth0 OUT= 
MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 SRC=X.X.X.X DST=Y.Y.Y.Y LEN=64 
TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP SPT=52900 DPT=5061 WINDOW=65535 
RES=0x00 SYN URGP=0 Mar  4 07:12:00 server-xip-01 kernel: New Connection 
IN=eth0 OUT= MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 SRC=X.X.X.X 
DST=Y.Y.Y.Y LEN=64 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP SPT=52900 
DPT=5061 WINDOW=65535 RES=0x00 SYN URGP=0 Mar  4 07:12:05 server-xip-01 kernel: 
New Connection IN=eth0 OUT= MAC=bc:76:4e:20:1f:fb:e8:ed:f3:3a:52:41:08:00 
SRC=X.X.X.X DST=Y.Y.Y.Y LEN=48 TOS=0x00 PREC=0x00 TTL=45 ID=0 DF PROTO=TCP 
SPT=52900 DPT=5061 WINDOW=65535 RES=0x00 SYN URGP=0 When it happens our app 
takes more than 10 sec to connect to the Kamailio socket.

I tried to increase the children configuration parameter in the cfg file 
because I thought there were not enough tcp receiver but with no luck.
Here are some configuration parameters:

children = 16 // was 8 before found this issue

# life time of TCP connection when there is no traffic # - a bit higher than 
registration expires to cope with UA behind NAT
tcp_connection_lifetime=3605

open_files_limit=8192

tcp_max_connections=8192
tls_max_connections=8192

Here is the output of the ulimit command:
ulimit -a
core file size  (blocks, -c) 0
data seg size   (kbytes, -d) unlimited
scheduling priority (-e) 0
file size   (blocks, -f) unlimited
pending signals (-i) 31393
max locked memory   (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files  (-n) 65535
pipe size(512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority  (-r) 0
stack size  (kbytes, -s) 8192
cpu time   (seconds, -t) unlimited
max user processes  (-u) 31393
virtual memory  (kbytes, -v) unlimited
file locks  (-x) unlimited
In the kamailio log file I don't see