<div dir="ltr">Hi Vlad - thanks for that, it's very helpful<div><br></div><div>All the best</div><div><br></div><div>Mark</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 28 Jul 2020 at 21:40, Vlad Patrascu <<a href="mailto:vladp@opensips.org">vladp@opensips.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Hi Mark,</p>
<p>thanks for the report! I have pushed a fix for the crash.<br>
</p>
<p>I've also updated the documentation to be more clear about how
raise_event() should be used and the changes from 3.0. Basically,
you don't have to necessarily pass both AVP parameters in 3.1, but
if you want to pass only the attribute values for the event you
should do:</p>
<p><font face="monospace">raise_event("E_WFC_REGISTERED", ,
$avp(values));</font></p>
<p>That is because the event attribute values can now only be passed
through the corresponding parameter(which is the last one). The
way you did it initially was equivalent to passing only the event
attribute names which in 3.1 results in an event with no
attributes at all. This in turn was unfortunately causing a crash.</p>
<p>Regards,<br>
<font face="monospace"></font></p>
<pre cols="72">--
Vlad Patrascu
OpenSIPS Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
<div>On 28.07.2020 17:42, Mark Allen wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>[SOLVED]</div>
<div><br>
</div>
Hi Stas - good call! It's a change in behaviour from 3.0.
<div><br>
</div>
<div>In 3.0 documentation says...</div>
<div><br>
</div>
<div> The next two parameters should be AVPs and they are
optional. If only one is present, it should contain the values
attached to the event.<br>
</div>
<div><br>
</div>
<div>In 3.1 it removes mention of the behaviour if only one AVP
is present, but it's not obvious and perhaps it could be
documented in the <a href="https://www.opensips.org/Documentation/Migration-3-0-0-to-3-1-0" target="_blank">https://www.opensips.org/Documentation/Migration-3-0-0-to-3-1-0</a>
guide? Also, perhaps 3.1 should handle it better if parameter
is missing rather than giving a segfault (something for 3.2?)</div>
<div><br>
</div>
<div>Once again I'm indebted to you for your help</div>
<div><br>
</div>
<div>thanks very much & all the best</div>
<div><br>
</div>
<div>Mark</div>
<div><br>
</div>
<div><br>
</div>
<div> </div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, 28 Jul 2020 at 15:22,
Stas Kobzar <<a href="mailto:staskobzar@gmail.com" target="_blank">staskobzar@gmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Hi Allen,<br>
<br>
Did you try with two parameters: name, value?
<div><br>
<div> <b>$avp(keys) = "registered";</b><br>
$avp(values) = "true";<br>
xlog("Raised E_WFC_REGISTERED $avp(values)");<br>
raise_event("E_WFC_REGISTERED", <b>$avp(keys)</b>,
$avp(values));</div>
</div>
<div><br>
</div>
<div>I know they are said to be optional in the
documentation but probably it is optional for two. Either
no params or if you pass parameters, you have to pass
both.</div>
</div>
<br>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, Jul 28, 2020 at
9:59 AM Mark Allen <<a href="mailto:mark@allenclan.co.uk" target="_blank">mark@allenclan.co.uk</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">We're upgrading from 3.0 to 3.1. Everything
seems ok except we get a weird error. We subscribe a
dynamic event...
<div><br>
</div>
<div><font face="monospace"> startup_route {<br>
subscribe_event("E_WFC_REGISTERED", "udp:<a href="http://127.0.0.1:8888" target="_blank">127.0.0.1:8888</a>");<br>
}</font><br>
</div>
<div><br>
</div>
<div>which we can see works from /var/log/syslog...</div>
<div><font face="monospace"> </font></div>
<div><font face="monospace"> event_datagram:mod_init:
initializing module ...<br>
</font></div>
<div><font face="monospace"> core:evi_publish_event:
Registered event <E_WFC_REGISTERED(20)<br>
</font></div>
<div><br>
</div>
<div>and in the script we invoke it with...</div>
<div><br>
</div>
<div><font face="monospace">
if(is_method("REGISTER")) {<br>
</font></div>
<div><font face="monospace"> $avp(values) =
"true";<br>
xlog("Raised E_WFC_REGISTERED
$avp(values)");<br>
raise_event("E_WFC_REGISTERED",$avp(values));<br>
</font></div>
<div><font face="monospace"><br>
</font></div>
<div><font face="arial, sans-serif">When a phone
registers, raise_event() is triggered and OpenSIPS
crashes with a segmentation fault - shown in
/var/log/syslog...</font></div>
<div><font face="arial, sans-serif"><br>
</font></div>
<div><font face="monospace"> Raised E_WFC_REGISTERED
true<br>
</font></div>
<font face="monospace"> CRITICAL:core:sig_usr:
segfault in process pid: 10525, id: 8<br>
segfault at 8 ip 000055cef821313f sp
00007ffcdf4d3410 error 4 in
opensips[55cef801a000+264000]<br>
kernel: [197593.785622] Code: 0e 00 4c 89 ef e8 1b
70 fc ff 49 63 74 24 08 49 8b 3c 24 e8 51 a1 fc ff 48
89 c2 48 8d 35 8f 0d 07 00 4c 89 ef e8 fb 6f fc ff
<49> 8b 46 08 48 85 c0 74 0b 48 83 78 18 00 0f
84 a5 02 00 00 e8 34<br>
<a>INFO:core:handle_sigs</a>: child process 10525 exited
by a signal 11<br>
<a>INFO:core:handle_sigs</a>: core was generated<br>
<a>INFO:core:handle_sigs</a>: terminating due to SIGCHLD</font>
<div><font face="monospace"><br>
</font></div>
<div><font face="arial, sans-serif">If I comment out
the </font>raise_event() line - OpenSIPS seems fine
and doesn't crash when passing through this code. </div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><font face="arial, sans-serif">Running gdb to get
core file backtrace we see...</font></div>
<div><font face="arial, sans-serif"><br>
</font></div>
<div><font face="monospace">Core was generated by
`/usr/sbin/opensips -P /run/opensips/opensips.pid -f
/etc/opensips/opensips.cfg'.<br>
Program terminated with signal SIGSEGV, Segmentation
fault.<br>
#0 evi_build_payload (params=0x0,
method=0x7f931f5b6f08, id=id@entry=0,
extra_param_k=extra_param_k@entry=0x0,<br>
extra_param_v=extra_param_v@entry=0x0) at
evi/evi_transport.c:159<br>
159 if (params->first &&
!params->first->name.s) {<br>
(gdb) bt full<br>
#0 evi_build_payload (params=0x0,
method=0x7f931f5b6f08, id=id@entry=0,
extra_param_k=extra_param_k@entry=0x0,<br>
extra_param_v=extra_param_v@entry=0x0) at
evi/evi_transport.c:159<br>
param = <optimized out><br>
param_obj = 0x0<br>
tmp = <optimized out><br>
ret_obj = 0x7f9323135fe0<br>
payload = 0x0<br>
__FUNCTION__ = "evi_build_payload"<br>
#1 0x00007f931b7d934f in datagram_raise
(msg=<optimized out>, ev_name=<optimized
out>, sock=0x7f931f5c54c8, params=<optimized
out>)<br>
at event_datagram.c:315<br>
ret = <optimized out><br>
buf = <optimized out><br>
__FUNCTION__ = "datagram_raise"<br>
#2 0x000055cef82148fb in evi_raise_event_msg
(msg=msg@entry=0x7f9323134890, id=id@entry=20,
params=params@entry=0x0)<br>
at evi/event_interface.c:208<br>
subs = 0x7f931f5c55a8<br>
prev = <optimized out><br>
now = 1595943308<br>
flags = 1073741838<br>
pflags = 0<br>
ret = 0<br>
__FUNCTION__ = "evi_raise_event_msg"<br>
#3 0x000055cef8216afb in evi_raise_script_event
(msg=0x7f9323134890, id=20, _a=<optimized
out>, _v=<optimized out>)<br>
at evi/event_interface.c:430<br>
vals = <optimized out><br>
attrs = <optimized out><br>
v_avp = <optimized out><br>
a_avp = <optimized out><br>
err = <optimized out><br>
val = {n = 587654904, s = {s =
0x7f932306e6f8 "\002", len = -133061172}}<br>
attr = {n = 0, s = {s = 0x0, len =
-133445686}}<br>
at = <optimized out><br>
params = 0x0<br>
__FUNCTION__ = "evi_raise_script_event"<br>
#4 0x000055cef8068c5f in w_raise_event
(msg=<optimized out>, ev_id=<optimized
out>, attrs_avp=<optimized out>,<br>
vals_avp=<optimized out>) at
core_cmds.c:1204<br>
__FUNCTION__ = "w_raise_event"<br>
#5 0x000055cef8086199 in do_action
(a=0x7f932304d020, msg=0x7f9323134890) at
action.c:972<br>
ret = <optimized out><br>
v = <optimized out><br>
i = <optimized out><br>
len = <optimized out><br>
cmatch = <optimized out><br>
aitem = <optimized out><br>
adefault = <optimized out><br>
spec = <optimized out><br>
val = {rs = {s = 0x7f932304c748 "\002", len
= 0}, ri = -129751552, flags = 21966}<br>
start = {tv_sec = 94347416839552, tv_usec =
140269924432168}<br>
end_time = <optimized out><br>
cmd = 0x55cef832c550 <core_cmds+11280><br>
acmd = <optimized out><br>
cmdp = {0x14, 0x7f932304cf88, 0x0, 0x2,
0x7f9323134890, 0x55cef80bb253
<eval_elem+1256>, 0x1, 0xc}<br>
tmp_vals = {{rs = {s = 0x400000000
<error: Cannot access memory at address
0x400000000>, len = 587509104}, ri = 18, flags =
0}, {rs = {s = 0x7f9323134890 "\001", len =
587509104}, ri = 588466320, flags = 32659}, {rs = {s
= 0x55cef8442600 <_oser_err_info> "", len =
-133061748}, ri = -131568035, flags = 21966}, {rs =
{s = 0x3 <error: Cannot access memory at address
0x3>, len = 587512256}, ri = 3, flags = 0}, {rs =
{s = 0x7ffcdf4d3790 "\220H\023#\223\177", len =
587509104}, ri = -131568035, flags = 21966}, {rs =
{s = 0x3 <error: Cannot access memory at address
0x3>, len = 0}, ri = 587655824, flags = 32659},
{rs = {s = 0x0, len = 588466320}, ri = 0, flags =
0}, {rs = {s = 0x55cef80baba7 <eval_expr+300>
"A\211\304D\213\005\277\355'", len = 593194504}, ri
= 2, flags = 0}}<br>
sval = {s = 0x7ffcdf4d3730 "]n(\370\316U",
len = 587515424}<br>
__FUNCTION__ = "do_action"</font><font face="arial, sans-serif"><br>
</font></div>
<div><font face="arial, sans-serif"> </font></div>
<div>(full backtrace is available)</div>
<div><br>
</div>
<div>Build is taken from 3.1 branch on GitHub</div>
<div>Server is running Debian 10 (Buster)</div>
<div><br>
</div>
<div><br>
</div>
</div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote>
</div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
</div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>