[prev in list] [next in list] [prev in thread] [next in thread] 

List:       serdev
Subject:    [sr-dev] Re: git:master:5c90e6e2: DMQ: dmq_notification_address_list is initialized to NULL
From:       "Olle E. Johansson" <oej () edvina ! net>
Date:       2022-12-21 15:13:54
Message-ID: 33301E81-7A99-4A1C-AB5D-E2AEC8F329A1 () edvina ! net
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On 21 Dec 2022, at 15:54, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
> 
> It is unlikely that this patch solves any eventual issues that you had.
> 
> You changed the comparison of a pointer with NULL to 0 and, in C, NULL and 0 are \
> the same in context of pointers: 
> - https://c-faq.com/null/nullor0.html <https://c-faq.com/null/nullor0.html>
> 
> So practically there is not change in behaviour.
Ok, so the change for better was still random. Oh well, it looks better to compare \
with the same value that we initialized with so I guess it doesn't harm.

We have problems with getting DMQ initializing properly with four notification nodes. \
Kamailio doesn't load all of them at start. We get very random behaviour. 

Debugging continues :-)… Who cares about holidays when you have an interesting \
problem at hand? :-) I'll create a local branch and add even more debugging.

/O

> 
> Cheers,
> Daniel
> 
> On 21.12.22 15:41, Olle E. Johansson wrote:
> > I suggest that this patch be backported :-)
> > 
> > Cheers,
> > /O
> > 
> > > Begin forwarded message:
> > > 
> > > From: Olle E. Johansson <oej@edvina.net <mailto:oej@edvina.net>>
> > > Subject: [sr-dev] git:master:5c90e6e2 <git:master:5c90e6e2>: DMQ: \
> > >                 dmq_notification_address_list is initialized to NULL
> > > Date: 21 December 2022 at 15:27:49 CET
> > > To: sr-dev@lists.kamailio.org <mailto:sr-dev@lists.kamailio.org>
> > > Reply-To: "Kamailio (SER) - Development Mailing List" \
> > > <sr-dev@lists.kamailio.org <mailto:sr-dev@lists.kamailio.org>> 
> > > Module: kamailio
> > > Branch: master
> > > Commit: 5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb
> > > URL: https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb \
> > > <https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb>
> > >  
> > > Author: Olle E. Johansson <oej@edvina.net <mailto:oej@edvina.net>>
> > > Committer: Olle E. Johansson <oej@edvina.net <mailto:oej@edvina.net>>
> > > Date: 2022-12-21T15:27:28+01:00
> > > 
> > > DMQ: dmq_notification_address_list is initialized to NULL
> > > 
> > > This code led to random and unpredictable behaviour when loading a \
> > > configuration with multiple notification nodes.
> > > 
> > > ---
> > > 
> > > Modified: src/modules/dmq/dmq.c
> > > 
> > > ---
> > > 
> > > Diff:  https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.diff \
> > > <https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.diff>
> > >                 
> > > Patch: https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.patch \
> > > <https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.patch>
> > >  
> > > ---
> > > 
> > > diff --git a/src/modules/dmq/dmq.c b/src/modules/dmq/dmq.c
> > > index 843b7e3e4d2..f4a66c3d847 100644
> > > --- a/src/modules/dmq/dmq.c
> > > +++ b/src/modules/dmq/dmq.c
> > > @@ -379,7 +379,7 @@ static int dmq_add_notification_address(modparam_t type, \
> > > void * val)  }
> > > 
> > > 	/* initial allocation */
> > > -	if (dmq_notification_address_list == 0) {
> > > +	if (dmq_notification_address_list == NULL) {
> > > 		dmq_notification_address_list = pkg_malloc(sizeof(str_list_t));
> > > 		if (dmq_notification_address_list == NULL) {
> > > 			PKG_MEM_ERROR;
> > > 
> > > _______________________________________________
> > > Kamailio (SER) - Development Mailing List
> > > To unsubscribe send an email to sr-dev-leave@lists.kamailio.org \
> > > <mailto:sr-dev-leave@lists.kamailio.org>
> > 
> 
> -- 
> Daniel-Constantin Mierla -- www.asipto.com <http://www.asipto.com/>
> www.twitter.com/miconda <http://www.twitter.com/miconda> -- \
> www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda>


[Attachment #5 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html; \
charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote \
type="cite" class=""><div class="">On 21 Dec 2022, at 15:54, Daniel-Constantin Mierla \
&lt;<a href="mailto:miconda@gmail.com" class="">miconda@gmail.com</a>&gt; \
wrote:</div><br class="Apple-interchange-newline"><div class="">  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class="">
  
  <div class="">
    <div class="moz-cite-prefix">It is unlikely that this patch solves
      any eventual issues that you had.</div>
    <div class="moz-cite-prefix"><br class="">
    </div>
    <div class="moz-cite-prefix">You changed the comparison of a pointer
      with NULL to 0 and, in C, NULL and 0 are the same in context of
      pointers:</div>
    <div class="moz-cite-prefix"><br class="">
    </div>
    <div class="moz-cite-prefix">&nbsp; - <a class="moz-txt-link-freetext" \
href="https://c-faq.com/null/nullor0.html">https://c-faq.com/null/nullor0.html</a></div>
  <div class="moz-cite-prefix"><br class="">
    </div>
    <div class="moz-cite-prefix">So practically there is not change in
      behaviour.</div></div></div></blockquote>Ok, so the change for better was still \
random. Oh well, it looks better to compare with the same value that we initialized \
with so I guess it doesn't harm.</div><div><br class=""></div><div>We have problems \
with getting DMQ initializing properly with four notification nodes. Kamailio doesn't \
load all of them at start. We get very random behaviour.&nbsp;</div><div><br \
class=""></div><div>Debugging continues :-)… Who cares about holidays when you have \
an interesting problem at hand? :-)</div><div>I'll create a local branch and add even \
more debugging.</div><div><br class=""></div><div>/O</div><div><br \
class=""><blockquote type="cite" class=""><div class=""><div class="">  <div \
class="moz-cite-prefix"><br class="">  </div>
    <div class="moz-cite-prefix">Cheers,<br class="">
      Daniel<br class="">
    </div>
    <div class="moz-cite-prefix"><br class="">
    </div>
    <div class="moz-cite-prefix">On 21.12.22 15:41, Olle E. Johansson
      wrote:<br class="">
    </div>
    <blockquote type="cite" \
                cite="mid:46FF1674-DD9C-417B-B81B-9637CB0A3E5F@edvina.net" class="">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class="">
      I suggest that this patch be backported :-)
      <div class=""><br class="">
      </div>
      <div class="">Cheers,</div>
      <div class="">/O<br class="">
        <div class=""><br class="">
          <blockquote type="cite" class="">
            <div class="">Begin forwarded message:</div>
            <br class="Apple-interchange-newline">
            <div style="margin-top: 0px; margin-right: 0px;
              margin-bottom: 0px; margin-left: 0px;" class=""><span \
style="font-family: -webkit-system-font, &quot;Helvetica Neue&quot;, Helvetica, \
sans-serif;" class=""><b class="">From: </b></span><span style="font-family: \
-webkit-system-font, Helvetica Neue,  Helvetica, sans-serif;" class="">Olle E. \
Johansson &lt;<a href="mailto:oej@edvina.net" class="moz-txt-link-freetext" \
moz-do-not-send="true">oej@edvina.net</a>&gt;<br class="">  </span></div>
            <div style="margin-top: 0px; margin-right: 0px;
              margin-bottom: 0px; margin-left: 0px;" class=""><span \
style="font-family: -webkit-system-font, &quot;Helvetica Neue&quot;, Helvetica, \
sans-serif;" class=""><b class="">Subject: </b></span><span style="font-family: \
-webkit-system-font, Helvetica Neue,  Helvetica, sans-serif;" class=""><b \
                class="">[sr-dev]
                  <a class="moz-txt-link-freetext" \
                href="git:master:5c90e6e2">git:master:5c90e6e2</a>: DMQ:
                  dmq_notification_address_list is initialized to NULL</b><br \
class="">  </span></div>
            <div style="margin-top: 0px; margin-right: 0px;
              margin-bottom: 0px; margin-left: 0px;" class=""><span \
style="font-family: -webkit-system-font, &quot;Helvetica Neue&quot;, Helvetica, \
sans-serif;" class=""><b class="">Date: </b></span><span style="font-family: \
-webkit-system-font, Helvetica Neue,  Helvetica, sans-serif;" class="">21 December \
2022 at  15:27:49 CET<br class="">
              </span></div>
            <div style="margin-top: 0px; margin-right: 0px;
              margin-bottom: 0px; margin-left: 0px;" class=""><span \
style="font-family: -webkit-system-font, &quot;Helvetica Neue&quot;, Helvetica, \
sans-serif;" class=""><b class="">To: </b></span><span style="font-family: \
-webkit-system-font, Helvetica Neue,  Helvetica, sans-serif;" class=""><a \
href="mailto:sr-dev@lists.kamailio.org" class="moz-txt-link-freetext" \
moz-do-not-send="true">sr-dev@lists.kamailio.org</a><br class="">  </span></div>
            <div style="margin-top: 0px; margin-right: 0px;
              margin-bottom: 0px; margin-left: 0px;" class=""><span \
style="font-family: -webkit-system-font, &quot;Helvetica Neue&quot;, Helvetica, \
sans-serif;" class=""><b class="">Reply-To: </b></span><span style="font-family: \
-webkit-system-font, Helvetica Neue,  Helvetica, sans-serif;" class="">"Kamailio \
(SER) -  Development Mailing List" &lt;<a href="mailto:sr-dev@lists.kamailio.org" \
class="moz-txt-link-freetext" \
moz-do-not-send="true">sr-dev@lists.kamailio.org</a>&gt;<br class="">  </span></div>
            <br class="">
            <div class="">
              <div class="">Module: kamailio<br class="">
                Branch: master<br class="">
                Commit: 5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb<br class="">
                URL: <a \
href="https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb" \
class="moz-txt-link-freetext" \
moz-do-not-send="true">https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb</a><br \
class="">  <br class="">
                Author: Olle E. Johansson &lt;<a href="mailto:oej@edvina.net" \
class="moz-txt-link-freetext" moz-do-not-send="true">oej@edvina.net</a>&gt;<br \
class="">  Committer: Olle E. Johansson &lt;<a href="mailto:oej@edvina.net" \
class="moz-txt-link-freetext" moz-do-not-send="true">oej@edvina.net</a>&gt;<br \
class="">  Date: 2022-12-21T15:27:28+01:00<br class="">
                <br class="">
                DMQ: dmq_notification_address_list is initialized to
                NULL<br class="">
                <br class="">
                This code led to random and unpredictable behaviour when
                loading a configuration with<br class="">
                multiple notification nodes.<br class="">
                <br class="">
                ---<br class="">
                <br class="">
                Modified: src/modules/dmq/dmq.c<br class="">
                <br class="">
                ---<br class="">
                <br class="">
                Diff: &nbsp;<a \
href="https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.diff" \
class="moz-txt-link-freetext" \
moz-do-not-send="true">https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.diff</a><br \
class="">  Patch: <a \
href="https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.patch" \
class="moz-txt-link-freetext" \
moz-do-not-send="true">https://github.com/kamailio/kamailio/commit/5c90e6e2885a60a1dc5de5ff697c93d6fe59a9cb.patch</a><br \
class="">  <br class="">
                ---<br class="">
                <br class="">
                diff --git a/src/modules/dmq/dmq.c
                b/src/modules/dmq/dmq.c<br class="">
                index 843b7e3e4d2..f4a66c3d847 100644<br class="">
                --- a/src/modules/dmq/dmq.c<br class="">
                +++ b/src/modules/dmq/dmq.c<br class="">
                @@ -379,7 +379,7 @@ static int
                dmq_add_notification_address(modparam_t type, void *
                val)<br class="">
                <span class="Apple-tab-span" style="white-space:pre">	</span>}<br \
class="">  <br class="">
                <span class="Apple-tab-span" style="white-space:pre">	</span>/*
                initial allocation */<br class="">
                -<span class="Apple-tab-span" style="white-space:pre">	</span>if
                (dmq_notification_address_list == 0) {<br class="">
                +<span class="Apple-tab-span" style="white-space:pre">	</span>if
                (dmq_notification_address_list == NULL) {<br class="">
                <span class="Apple-tab-span" style="white-space:pre">	</span><span \
class="Apple-tab-span" style="white-space:pre">	</span>dmq_notification_address_list  \
                = pkg_malloc(sizeof(str_list_t));<br class="">
                <span class="Apple-tab-span" style="white-space:pre">	</span><span \
class="Apple-tab-span" style="white-space:pre">	</span>if  \
(dmq_notification_address_list == NULL) {<br class="">  <span class="Apple-tab-span" \
style="white-space:pre">	</span><span class="Apple-tab-span" \
style="white-space:pre">	</span><span class="Apple-tab-span" \
style="white-space:pre">	</span>PKG_MEM_ERROR;<br class="">  <br class="">
                _______________________________________________<br class="">
                Kamailio (SER) - Development Mailing List<br class="">
                To unsubscribe send an email to <a \
href="mailto:sr-dev-leave@lists.kamailio.org" class="moz-txt-link-freetext" \
moz-do-not-send="true">sr-dev-leave@lists.kamailio.org</a><br class="">  </div>
            </div>
          </blockquote>
        </div>
        <br class="">
      </div>
    </blockquote><p class=""><br class="">
    </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></pre>  \
</div>

</div></blockquote></div><br class=""></body></html>



_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-leave@lists.kamailio.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic