<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hello,</p>
<p>what's the version of Kamailio and the operating system you run
on?</p>
<p>Cheers,<br>
Daniel<br>
</p>
<br>
<div class="moz-cite-prefix">On 28.07.17 23:53, Cody Herzog wrote:<br>
</div>
<blockquote type="cite"
cite="mid:2AF4E0DB5D20734E8939C5EF204ACBAC0154BAFD64@ITHMail2.ith.local">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Hello.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Inside the tm:local-request route, I am
trying to modify the body of outgoing NOTIFY messages using
the subst_body() function.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Things seem to work fine most of the time.
The NOTIFY messages are correctly modified. However, I will
very rarely hit a crash.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I can force the crash to happen more
quickly by stress testing with thousands of NOTIFY messages
being modified.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is it safe to call subst() or subst_body()
inside the tm:local-request route? If not, is there another
way I can modify the outgoing NOTIFY messages safely?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Note that I am also calling append_hf()
inside the same tm:local-request route, but that has been
working for a very long time without causing any problems.
Could there be some kind of bad interaction between
append_hf() and subst_body()?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Strangely, it seems like using subst()
makes the crash more likely to happen. For some reason,
subst_body() seems to be more robust.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Here are the logs I see:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">---------<o:p></o:p></p>
<p class="MsoNormal">Jul 28 10:57:40 SIPCOMM-VEGAS-TEST
/usr/local/sbin/kamailio[2476]: CRITICAL: <core>
[data_lump.c:292]: del_lump(): offset exceeds message size
(1625 > 1194) aborting...<o:p></o:p></p>
<p class="MsoNormal">Jul 28 10:57:43 SIPCOMM-VEGAS-TEST
/usr/local/sbin/kamailio[2481]: CRITICAL: <core>
[pass_fd.c:275]: receive_fd(): EOF on 53<o:p></o:p></p>
<p class="MsoNormal">Jul 28 10:57:44 SIPCOMM-VEGAS-TEST
/usr/local/sbin/kamailio[2367]: ALERT: <core>
[main.c:731]: handle_sigs(): child process 2476 exited by a
signal 6<o:p></o:p></p>
<p class="MsoNormal">Jul 28 10:57:44 SIPCOMM-VEGAS-TEST
/usr/local/sbin/kamailio[2367]: ALERT: <core>
[main.c:734]: handle_sigs(): core was generated<o:p></o:p></p>
<p class="MsoNormal">Jul 28 10:57:44 SIPCOMM-VEGAS-TEST
/usr/local/sbin/kamailio[2367]: INFO: <core>
[main.c:756]: handle_sigs(): terminating due to SIGCHLD<o:p></o:p></p>
<p class="MsoNormal">---------<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Here is a GDB back trace from the core
dump:<o:p></o:p></p>
<p class="MsoNormal">---------<o:p></o:p></p>
<p class="MsoNormal">#0 0x00007fd91a567c37 in __GI_raise
(sig=sig@entry=6) at
../nptl/sysdeps/unix/sysv/linux/raise.c:56<o:p></o:p></p>
<p class="MsoNormal">#1 0x00007fd91a56b028 in __GI_abort () at
abort.c:89<o:p></o:p></p>
<p class="MsoNormal">#2 0x000000000044e981 in del_lump
(msg=0x7fd917c5ed60 <lreq>, offset=1625, len=20,
type=HDR_OTHER_T) at data_lump.c:293<o:p></o:p></p>
<p class="MsoNormal">#3 0x00007fd91676297f in subst_f
(msg=0x7fd917c5ed60 <lreq>, subst=0x7fd919e5ccc0
"\320\356\345\031\331\177", ignored=0x0) at textops.c:681<o:p></o:p></p>
<p class="MsoNormal">#4 0x000000000041e1dd in do_action
(h=0x7ffd364b87c0, a=0x7fd919e9b438, msg=0x7fd917c5ed60
<lreq>) at action.c:1059<o:p></o:p></p>
<p class="MsoNormal">#5 0x000000000042a917 in run_actions
(h=0x7ffd364b87c0, a=0x7fd919e9b438, msg=0x7fd917c5ed60
<lreq>) at action.c:1548<o:p></o:p></p>
<p class="MsoNormal">#6 0x000000000042af94 in run_actions_safe
(h=0x7ffd364ba5b0, a=0x7fd919e9b438, msg=0x7fd917c5ed60
<lreq>) at action.c:1613<o:p></o:p></p>
<p class="MsoNormal">#7 0x0000000000549972 in rval_get_int
(h=0x7ffd364ba5b0, msg=0x7fd917c5ed60 <lreq>,
i=0x7ffd364b8b58, rv=0x7fd919e9ced8, cache=0x0) at
rvalue.c:912<o:p></o:p></p>
<p class="MsoNormal">#8 0x000000000054dc7c in
rval_expr_eval_int (h=0x7ffd364ba5b0, msg=0x7fd917c5ed60
<lreq>, res=0x7ffd364b8b58, rve=0x7fd919e9ced0) at
rvalue.c:1910<o:p></o:p></p>
<p class="MsoNormal">#9 0x000000000041dc52 in do_action
(h=0x7ffd364ba5b0, a=0x7fd919e9d990, msg=0x7fd917c5ed60
<lreq>) at action.c:1029<o:p></o:p></p>
<p class="MsoNormal">#10 0x000000000042a917 in run_actions
(h=0x7ffd364ba5b0, a=0x7fd919e9d990, msg=0x7fd917c5ed60
<lreq>) at action.c:1548<o:p></o:p></p>
<p class="MsoNormal">#11 0x000000000041e0c4 in do_action
(h=0x7ffd364ba5b0, a=0x7fd919e9dad8, msg=0x7fd917c5ed60
<lreq>) at action.c:1044<o:p></o:p></p>
<p class="MsoNormal">#12 0x000000000042a917 in run_actions
(h=0x7ffd364ba5b0, a=0x7fd919e973b8, msg=0x7fd917c5ed60
<lreq>) at action.c:1548<o:p></o:p></p>
<p class="MsoNormal">#13 0x000000000041ab46 in do_action
(h=0x7ffd364ba5b0, a=0x7fd919e95d70, msg=0x7fd917c5ed60
<lreq>) at action.c:677<o:p></o:p></p>
<p class="MsoNormal">#14 0x000000000042a917 in run_actions
(h=0x7ffd364ba5b0, a=0x7fd919e8f330, msg=0x7fd917c5ed60
<lreq>) at action.c:1548<o:p></o:p></p>
<p class="MsoNormal">#15 0x000000000041e0c4 in do_action
(h=0x7ffd364ba5b0, a=0x7fd919e95eb8, msg=0x7fd917c5ed60
<lreq>) at action.c:1044<o:p></o:p></p>
<p class="MsoNormal">#16 0x000000000042a917 in run_actions
(h=0x7ffd364ba5b0, a=0x7fd919e8c8e0, msg=0x7fd917c5ed60
<lreq>) at action.c:1548<o:p></o:p></p>
<p class="MsoNormal">#17 0x000000000042b07d in run_top_route
(a=0x7fd919e8c8e0, msg=0x7fd917c5ed60 <lreq>, c=0x0) at
action.c:1634<o:p></o:p></p>
<p class="MsoNormal">#18 0x00007fd917a0539a in t_uac_prepare
(uac_r=0x7ffd364baf20, dst_req=0x7ffd364ba8f0,
dst_cell=0x7ffd364ba8f8) at uac.c:391<o:p></o:p></p>
<p class="MsoNormal">#19 0x00007fd917a07945 in t_uac_with_ids
(uac_r=0x7ffd364baf20, ret_index=0x0, ret_label=0x0) at
uac.c:599<o:p></o:p></p>
<p class="MsoNormal">#20 0x00007fd917a07918 in t_uac
(uac_r=0x7ffd364baf20) at uac.c:584<o:p></o:p></p>
<p class="MsoNormal">#21 0x00007fd917a09b9e in req_within
(uac_r=0x7ffd364baf20) at uac.c:802<o:p></o:p></p>
<p class="MsoNormal">#22 0x00007fd914674052 in
send_notify_request (subs=0x7ffd364bb200, watcher_subs=0x0,
n_body=0x0, force_null_body=0) at notify.c:1600<o:p></o:p></p>
<p class="MsoNormal">#23 0x00007fd9146754b3 in notify
(subs=0x7ffd364bb200, watcher_subs=0x0, n_body=0x0,
force_null_body=0) at notify.c:1690<o:p></o:p></p>
<p class="MsoNormal">#24 0x00007fd9146cec6a in
update_subscription (msg=0x7fd919efeb70, subs=0x7ffd364bb200,
to_tag_gen=1, sent_reply=0x7ffd364bb16c) at subscribe.c:697<o:p></o:p></p>
<p class="MsoNormal">#25 0x00007fd9146d45b7 in handle_subscribe
(msg=0x7fd919efeb70, watcher_user=..., watcher_domain=...) at
subscribe.c:1057<o:p></o:p></p>
<p class="MsoNormal">#26 0x00007fd9146d08b0 in handle_subscribe0
(msg=0x7fd919efeb70) at subscribe.c:816<o:p></o:p></p>
<p class="MsoNormal">#27 0x000000000041e155 in do_action
(h=0x7ffd364bd680, a=0x7fd919e19508, msg=0x7fd919efeb70) at
action.c:1053<o:p></o:p></p>
<p class="MsoNormal">#28 0x000000000042a917 in run_actions
(h=0x7ffd364bd680, a=0x7fd919e19508, msg=0x7fd919efeb70) at
action.c:1548<o:p></o:p></p>
<p class="MsoNormal">#29 0x000000000041e112 in do_action
(h=0x7ffd364bd680, a=0x7fd919e19650, msg=0x7fd919efeb70) at
action.c:1048<o:p></o:p></p>
<p class="MsoNormal">#30 0x000000000042a917 in run_actions
(h=0x7ffd364bd680, a=0x7fd919e02638, msg=0x7fd919efeb70) at
action.c:1548<o:p></o:p></p>
<p class="MsoNormal">#31 0x000000000041e0c4 in do_action
(h=0x7ffd364bd680, a=0x7fd919e199c0, msg=0x7fd919efeb70) at
action.c:1044<o:p></o:p></p>
<p class="MsoNormal">#32 0x000000000042a917 in run_actions
(h=0x7ffd364bd680, a=0x7fd919e199c0, msg=0x7fd919efeb70) at
action.c:1548<o:p></o:p></p>
<p class="MsoNormal">#33 0x000000000041e112 in do_action
(h=0x7ffd364bd680, a=0x7fd919e19b08, msg=0x7fd919efeb70) at
action.c:1048<o:p></o:p></p>
<p class="MsoNormal">#34 0x000000000042a917 in run_actions
(h=0x7ffd364bd680, a=0x7fd919df99d8, msg=0x7fd919efeb70) at
action.c:1548<o:p></o:p></p>
<p class="MsoNormal">#35 0x000000000041ab46 in do_action
(h=0x7ffd364bd680, a=0x7fd919dbe960, msg=0x7fd919efeb70) at
action.c:677<o:p></o:p></p>
<p class="MsoNormal">#36 0x000000000042a917 in run_actions
(h=0x7ffd364bd680, a=0x7fd919daedf8, msg=0x7fd919efeb70) at
action.c:1548<o:p></o:p></p>
<p class="MsoNormal">#37 0x000000000042b07d in run_top_route
(a=0x7fd919daedf8, msg=0x7fd919efeb70, c=0x0) at action.c:1634<o:p></o:p></p>
<p class="MsoNormal">#38 0x000000000050f678 in receive_msg
(buf=0x7fd8f2c6ce28 "SUBSCRIBE
<a class="moz-txt-link-freetext" href="sip:endpoint-1720@intouchstaging.com">sip:endpoint-1720@intouchstaging.com</a> SIP/2.0\r\nRecord-Route:
<a class="moz-txt-link-rfc2396E" href="sip:64.64.203.109:443;transport=tls;lr=on"><sip:64.64.203.109:443;transport=tls;lr=on></a>\r\nAccept:
application/dialog-info+xml, application/pidf+xml,
application/pidf-diff+xml,"..., len=1284,
rcv_info=0x7fd8f2c6cb50) at receive.c:196<o:p></o:p></p>
<p class="MsoNormal">#39 0x00000000005fb99e in receive_tcp_msg
(tcpbuf=0x7fd8f2c6ce28 "SUBSCRIBE
<a class="moz-txt-link-freetext" href="sip:endpoint-1720@intouchstaging.com">sip:endpoint-1720@intouchstaging.com</a> SIP/2.0\r\nRecord-Route:
<a class="moz-txt-link-rfc2396E" href="sip:64.64.203.109:443;transport=tls;lr=on"><sip:64.64.203.109:443;transport=tls;lr=on></a>\r\nAccept:
application/dialog-info+xml, application/pidf+xml,
application/pidf-diff+xml,"..., len=1284,
rcv_info=0x7fd8f2c6cb50, con=0x7fd8f2c6cb38) at
tcp_read.c:1207<o:p></o:p></p>
<p class="MsoNormal">#40 0x00000000005fd48c in tcp_read_req
(con=0x7fd8f2c6cb38, bytes_read=0x7ffd364bdb7c,
read_flags=0x7ffd364bdb84) at tcp_read.c:1411<o:p></o:p></p>
<p class="MsoNormal">#41 0x0000000000600aee in handle_io
(fm=0x7fd919f07d80, events=1, idx=-1) at tcp_read.c:1643<o:p></o:p></p>
<p class="MsoNormal">#42 0x00000000005f3ab8 in
io_wait_loop_epoll (h=0xa3d3e0 <io_w>, t=2, repeat=0) at
io_wait.h:1061<o:p></o:p></p>
<p class="MsoNormal">#43 0x0000000000601cf7 in tcp_receive_loop
(unix_sock=57) at tcp_read.c:1755<o:p></o:p></p>
<p class="MsoNormal">#44 0x00000000005ea235 in tcp_init_children
() at tcp_main.c:4788<o:p></o:p></p>
<p class="MsoNormal">#45 0x00000000004ab048 in main_loop () at
main.c:1675<o:p></o:p></p>
<p class="MsoNormal">#46 0x00000000004b10c2 in main (argc=13,
argv=0x7ffd364be258) at main.c:2566<o:p></o:p></p>
<p class="MsoNormal">---------<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks very much.<o:p></o:p></p>
<p class="MsoNormal"> -Cody<o:p></o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
</body>
</html>