<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<tt>Hi, Maxim!<br>
<br>
At this point, I think an extra strdup() is the best way to go.<br>
Later on, when we will decide to migrate to Python >3.4, we
will be able to provide our own heap allocators[1]. I think this
is the way we should aim.<br>
We are already planning some refactoring of this in the OpenSIPS
3.x branch. Most likely this is something that we should consider
when doing devel there.<br>
<br>
Regarding the Pull request you've done, I will send some comments
on github.<br>
<br>
[1]
<a class="moz-txt-link-freetext" href="https://www.python.org/dev/peps/pep-0445/#make-pymem-malloc-reuse-pymem-rawmalloc-by-default">https://www.python.org/dev/peps/pep-0445/#make-pymem-malloc-reuse-pymem-rawmalloc-by-default</a><br>
<br>
Best regards,<br>
</tt>
<pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Solutions
<a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
<div class="moz-cite-prefix">On 02/15/2017 04:21 AM, Maxim Sobolev
wrote:<br>
</div>
<blockquote
cite="mid:CAH7qZftbtAN=TF4ZWrsTALOchj-1bSs6v3xyaitgZvfAMBUjHQ@mail.gmail.com"
type="cite">
<div dir="ltr">Opted out to do extra strdup() at this point.
Still, would be nice to have fixup API to be more flexible with
the arguments management. In my view this would greatly enhance
ability to hook opensips into high-performance language and
other backends, which are likely to have its own heap
management.
<div><br>
</div>
<div><a moz-do-not-send="true"
href="https://github.com/OpenSIPS/opensips/pull/1056">https://github.com/OpenSIPS/opensips/pull/1056</a><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Feb 13, 2017 at 9:06 PM, Maxim
Sobolev <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:sobomax@sippysoft.com" target="_blank">sobomax@sippysoft.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi Bogdan, thanks for merging this little
fix. It turns out there is another mode of failure in this
module now. This is in the case when we pass a string
argument that is getting converting to uint
via fixup_spve_uint(). The string is allocated by the
python code, so it fails when fixup_uint() is trying to
deallocate it. One obvious way to fix this would be to
pkg_malloc() and copy, but that's obviously an unnecessary
overhead. I was curious what do you guys think about
extending "fixup" API to take some additional flags to
avoid trying to pkg_free() any of the parameters?
Obviously that would touch many modules, so it would be
nice to make the API generic and so that more options can
be added in the future. I made some proof of concept patch
over this weekend, would be nice to hear some feedback on
general approach:
<div><br>
</div>
<div><a moz-do-not-send="true"
href="https://github.com/OpenSIPS/opensips/compare/master...sippy:master_fixup_opts"
target="_blank">https://github.com/OpenSIPS/<wbr>opensips/compare/master...<wbr>sippy:master_fixup_opts</a></div>
<div><br>
</div>
<div>Some debug wrt crash in question is below:<br>
<div><br>
</div>
<div>msg.call_function('www_<wbr>challenge', realm, '0')</div>
<div><br>
</div>
<div>It tries to deallocate "0" that is managed by the
python code. </div>
<div><br>
</div>
<div>
<div>(gdb) print act->elem[2]</div>
<div>$4 = {type = 1, u = {number = 34368845180, string
= 0x8008af57c "0", data = 0x8008af57c, s = {s =
0x8008af57c "0", len = 0}, item = 0x8008af57c}}</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>#1 0x0000000800c7f386 in raise () from
/lib/libc.so.7</div>
<div>#2 0x0000000800c7f309 in abort () from
/lib/libc.so.7</div>
<div>#3 0x00000000004706fc in fixup_uint ()</div>
<div>#4 0x0000000000473baa in fixup_spve_uint ()</div>
<div>#5 0x0000000803bc5473 in msg_call_function
(self=0x800822198, args=0x80aaf38c0) at
python_msgobj.c:240</div>
<div>#6 0x0000000803eb5393 in PyEval_EvalFrameEx ()
from /usr/local/lib/libpython2.7.<wbr>so.1</div>
<div>#7 0x0000000803eae2c4 in PyEval_EvalCodeEx ()
from /usr/local/lib/libpython2.7.<wbr>so.1</div>
<div>#8 0x0000000803e3e74c in ?? () from
/usr/local/lib/libpython2.7.<wbr>so.1</div>
<div>#9 0x0000000803e1a854 in PyObject_Call () from
/usr/local/lib/libpython2.7.<wbr>so.1</div>
<div>#10 0x0000000803e26913 in ?? () from
/usr/local/lib/libpython2.7.<wbr>so.1</div>
<div>#11 0x0000000803e1a854 in PyObject_Call () from
/usr/local/lib/libpython2.7.<wbr>so.1</div>
<div>#12 0x0000000803eb9efd in
PyEval_CallObjectWithKeywords () from
/usr/local/lib/libpython2.7.<wbr>so.1</div>
<div>#13 0x0000000803bc7ace in python_exec2
(_msg=0x801428b80, method_name=0x801425d88
"www_authenticate", mystr=0x0) at python_exec.c:100</div>
<div>#14 0x0000000803bc7633 in python_exec1
(_msg=0x801428b80, method_name=0x801425d88
"www_authenticate", foobar=0x0) at python_exec.c:41</div>
</div>
<div><br>
</div>
<div>-Max</div>
<div><br>
</div>
<div><br>
</div>
</div>
<div>
<div class="h5">
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Feb 13, 2017 at
12:27 AM, Bogdan Andrei IANCU <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:notifications@github.com"
target="_blank">notifications@github.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0
0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
<p>Merged <a moz-do-not-send="true"
href="https://github.com/OpenSIPS/opensips/pull/1050"
class="m_-1866566139664187196m_2104704648861774057issue-link
m_-1866566139664187196m_2104704648861774057js-issue-link"
target="_blank">#1050</a>.</p>
<p style="font-size:small;color:#666">—<br>
You are receiving this because you authored
the thread.<br>
Reply to this email directly, <a
moz-do-not-send="true"
href="https://github.com/OpenSIPS/opensips/pull/1050#event-959176889"
target="_blank">view it on GitHub</a>, or <a
moz-do-not-send="true"
href="https://github.com/notifications/unsubscribe-auth/AANWJtg_7ZwxY2Vhvx4XhfifG-MWtQOEks5rcBPogaJpZM4L-Ki_"
target="_blank">mute the thread</a>.<img
moz-do-not-send="true" alt=""
src="https://github.com/notifications/beacon/AANWJgdeL5_L_qXqlJbSGymmuQ9r7iiSks5rcBPogaJpZM4L-Ki_.gif"
width="1" height="1"></p>
<div>
<div> </div>
</div>
</blockquote>
</div>
<div class="m_-1866566139664187196gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr"><br>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">Maksym Sobolyev<br>
Sippy Software, Inc.<br>
Internet Telephony (VoIP) Experts<br>
Tel (Canada): +1-778-783-0474<br>
Tel (Toll-Free): +1-855-747-7779<br>
Fax: +1-866-857-6942<br>
Web: <a moz-do-not-send="true"
href="http://www.sippysoft.com" target="_blank">http://www.sippysoft.com</a><br>
MSN: <a moz-do-not-send="true"
href="mailto:sales@sippysoft.com" target="_blank">sales@sippysoft.com</a><br>
Skype: SippySoft<br>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Devel@lists.opensips.org">Devel@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/devel">http://lists.opensips.org/cgi-bin/mailman/listinfo/devel</a>
</pre>
</blockquote>
<br>
</body>
</html>