<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hello,<br>
</p>
<div class="moz-cite-prefix">On 28.12.18 16:37, Victor Seva wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAAgy_Vm1-aDHXLDh_zFC3RDoffM8aJfaACTOphnHeWQ67xpEzA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>Hello,<br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Fri, 28 Dec 2018 at 16:22, Daniel-Constantin
Mierla <<a href="mailto:miconda@gmail.com"
target="_blank" moz-do-not-send="true">miconda@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">I noticed many commits
replacing the log messages in case of allocation<br>
failure with some macros. That is good, bringing
consistency, but I<br>
think that we should offer couple of them. The current one
is rather dry<br>
(meaning that it offers very few context details), which
matches most of<br>
the existing log messages used in such cases.<br>
<br>
But there are also other log messages for such cases which
give more<br>
details, like for what the allocation fails, some also
giving the<br>
requested size of allocation.<br>
<br>
So besides the current two macros (one for shm and one for
pkg), we<br>
should add few more. Like:<br>
<br>
#define PKG_MEM_ERROR_MSG(m) LM_ERR("could not allocate
private memory<br>
from pkg pool - %s\n", m);<br>
<br>
So one can do:<br>
<br>
PKG_MEM_ERROR_MSG("needed for htable struct");<br>
<br>
And one to include also the size:<br>
<br>
#define PKG_MEM_ERROR_SZ(s, m) LM_ERR("could not allocate
private memory<br>
from pkg pool - size: %u - %s\n", (unsigned int)s, m);<br>
<br>
No need to revert what was done, but I think for the future
we would<br>
preserve better information for troubleshooting in some
cases, instead<br>
of replacing those messages that now have more details with
the bare<br>
error log message.<br>
</blockquote>
<div><br>
</div>
<div>I'm not sure about the benefits of adding a custom
message but I see that having the requested size in the log
maybe can be useful in case of a mistake in the
(re)allocation.</div>
<div>Do you think that if the pool is exhausted, makes sense
to know, with a custom log, where the reservation failed?</div>
</div>
</div>
</blockquote>
<p>The custom message is useful to avoid going to source code to
figure out where it fails inside same function. There can be
couple of allocations inside the same function and when one runs
an older version and reports some errors it can happen that the
current head of that branche has different lines for those
allocations, so it would require to check out the exact snapshot.
However, sometime that is no longer known if it is running a build
from a tarball that doesn't have the git commit id. Also, I do not
remember if deb/rpm packages put commit id inside the version
string. But I remember I faced couple of situations like these in
the past and decided to add more context in the error message,
even if it was still a static string.<br>
</p>
<p>Cheers,<br>
Daniel<br>
</p>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<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 World Conference - May 6-8, 2019 -- <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a>
Kamailio Advanced Training - Mar 4-6, 2019 in Berlin; Mar 25-27, 2019, in Washington, DC, USA -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a></pre>
</body>
</html>