[SR-Users] send_all blocks indefinitely

Robert jcwarrior10 at gmail.com
Thu Mar 16 22:30:27 CET 2017


H all,

Recently, when I'm trying to load test Kamailio with a single proxy, it hung
at around 15000 TPS. I attached gdb to one of the kamailio processes and I
saw this:

(gdb) where
#0  0x00007fa8872366ad in __libc_send (fd=13, buf=0x7ffe6e0e5350, n=16,
flags=-2027723091) at ../sysdeps/unix/sysv/linux/x86_64/send.c:27
#1  0x00000000004eb635 in send_all (socket=13, data=0x7ffe6e0e5350,
data_len=16) at pass_fd.c:133
#2  0x00007fa4155a1b69 in tcp_close_connection (conn_id=28022) at
tcp_funcs.c:199
#3  0x00007fa4155a363f in cleanup (start=0x7fa4540c3ab8, end=0x7fa42f92dca0)
at tcp_funcs.c:337
#4  0x00007fa4155a1496 in timer_clean_tcp_connections (ticks=18583555,
param=0x0) at tcp_funcs.c:165
#5  0x0000000000617f79 in fork_basic_timer (child_id=-1, desc=0x7fa4155a88e0
"Connections cleanup timer", make_sock=1, f=0x7fa4155a0ac6
<timer_clean_tcp_connections>, param=0x0, interval=30) at timer_proc.c:79
#6  0x00007fa4155a5816 in child_init (rank=0) at tcp_mod.c:176

tcp_func.c is something I wrote myself, which is basically a timer that runs
periodically to try to clean up tcp connections that I no longer need. The
code for tcp_close_connection is taken directly from usrloc > urecord.c >
close_connection()

>From the gdb output above, it seems like send_all is blocked and never
returned, which led to my proxy to hang. 

In kamailio/src/core/pass_fd.c, I saw this:
...
/** sends all data (takes care of signals) (assumes blocking fd)
 * returns number of bytes sent or < 0 for an error */
int send_all(int socket, void* data, int data_len)

But in kamailio/doc/misc/TODO, I saw this:
...
x [tcp] make send_all, send  non-blocking ready ?
x [tcp] tcp_send w/ timeout (to avoid waiting forever to send DOS)


So, my question is, is send_all() suppose to block or not?

I'm fairly new to how tcp and socket connection works. Any help will be
appreciated!

Thanks,
Robert




--
View this message in context: http://sip-router.1086192.n5.nabble.com/send-all-blocks-indefinitely-tp156948.html
Sent from the Users mailing list archive at Nabble.com.



More information about the sr-users mailing list