<div dir="ltr">Hi Razvan,<div><br></div><div>I looked at both avp_map and avp_map_shm. In our case, only avp_map_shm is relevant since the leak appears in shared memory. I only see 4 elements in this map while I can see a lot of remaining AVPs when looking at the memory dump created at shutdown using QM debug. Therefore, it looks like these AVPs are not in the map. Looking at the new_avp function in usr_avp.c, I don&#39;t see at any moment that an entry is added to the map for the new AVP.</div><div><br></div><div><div>(gdb) print avp_map_shm-&gt;avl_count</div><div>$5 = 4</div><div>(gdb) print avp_map-&gt;avl_count</div><div>$6 = 140</div></div><div><br></div><div>Any idea?</div><div><br></div><div>At which moment during execution an AVP is destroyed? Is it required for modules returning values to script through AVPs to destroy these AVPs? or are they automatically destroyed?</div><div><br></div><div>Thanks,</div><div>Mickael</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 18, 2015 at 7:33 PM, Răzvan Crainea <span dir="ltr">&lt;<a href="mailto:razvan@opensips.org" target="_blank">razvan@opensips.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <tt><span class="">Hi, Mickael!<br>
      <br>
      This is not entirely true - you can define AVPs with the integer
      value 0. Those will have avp-&gt;flags == 0 and avp-&gt;data == 0.<br>
      What I&#39;d do, is to note down the avp-&gt;id value of those AVPs
      and then try to see their names. To do that, you&#39;d have to look
      into the avp_map and avp_map_shm maps to see the corresponding
      name for that id. Alternatively you can call in your script the
      avp_print() method, which prints all the AVPs for a specific
      transaction along with their id and names. Let me know how this
      goes.<br>
      <br></span>
      Best regards,</tt><span class="">
    <pre cols="72">Răzvan Crainea
OpenSIPS Solutions
<a href="http://www.opensips-solutions.com" target="_blank">www.opensips-solutions.com</a></pre>
    </span><div><div class="h5"><div>On 06/18/2015 12:48 PM, Mickael
      Marrache wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">To add more information, I remember there was no
        way to define an integer AVP with value 0. I see a lot of such
        AVPs.</div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Thu, Jun 18, 2015 at 12:03 PM,
          Mickael Marrache <span dir="ltr">&lt;<a href="mailto:mickaelmarrache@gmail.com" target="_blank"></a><a href="mailto:mickaelmarrache@gmail.com" target="_blank">mickaelmarrache@gmail.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Correction of my previous email.
              <div><br>
              </div>
              <div>When I said I found AVPs without data, I may be
                wrong. avp-&gt;flags == 0 probably means the AVP data is
                an integer. So, that explains the weird values (e.g.
                0x8000) I tried to interpret as memory addresses.</div>
              <span><font color="#888888">
                  <div><br>
                  </div>
                  <div>Mickael</div>
                </font></span></div>
            <div>
              <div>
                <div class="gmail_extra"><br>
                  <div class="gmail_quote">On Thu, Jun 18, 2015 at 11:12
                    AM, Mickael Marrache <span dir="ltr">&lt;<a href="mailto:mickaelmarrache@gmail.com" target="_blank"></a><a href="mailto:mickaelmarrache@gmail.com" target="_blank">mickaelmarrache@gmail.com</a>&gt;</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 Razvan,
                        <div><br>
                        </div>
                        <div>Here is what I&#39;ve done.</div>
                        <div><br>
                        </div>
                        <div>I took a core dump of the attendant
                          process. Then, I stopped OpenSIPS so that it
                          frees allocated fragments, and at the end
                          lists all fragments that are still allocated.</div>
                        <div><br>
                        </div>
                        <div>In this list of fragments, I can see a lot
                          of AVPs.</div>
                        <div><br>
                        </div>
                        <div>I see some AVPs without data (avp-&gt;data
                          == NULL, avp-&gt;flags == 0). But something is
                          weird, it looks like that all AVPs that don&#39;t
                          have data have the same id. It looks like
                          duplicate AVPs (in different memory
                          fragments).</div>
                        <div><br>
                        </div>
                        <div>Some AVPs do have data and have a format
                          that looks valid.</div>
                        <div><br>
                        </div>
                        <div>Some AVPs looks corrupted. For example, I
                          found an AVP with same ID as the AVPs without
                          data, but avp-&gt;data == 0x8000 which looks
                          completely wrong.</div>
                        <div><br>
                        </div>
                        <div>Thanks,</div>
                        <div>Mickael</div>
                      </div>
                      <div>
                        <div>
                          <div class="gmail_extra"><br>
                            <div class="gmail_quote">On Thu, Jun 18,
                              2015 at 10:11 AM, Mickael Marrache <span dir="ltr">&lt;<a href="mailto:mickaelmarrache@gmail.com" target="_blank">mickaelmarrache@gmail.com</a>&gt;</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 Razvan,
                                  <div><br>
                                  </div>
                                  <div>I created a core dump for the
                                    attendant process. Is it enough or
                                    we also need core dumps for other
                                    processes? Note that the leak
                                    appears in shared memory.</div>
                                  <div><br>
                                  </div>
                                  <div>We do use QM debug for this
                                    version, this is how I discovered
                                    the remaining AVPs at shutdown where
                                    the remaining allocated memory
                                    fragments are listed.</div>
                                  <div><br>
                                  </div>
                                  <div>Do you know where I should look
                                    for the AVPs in the core dump?</div>
                                  <div><br>
                                  </div>
                                  <div>Thanks,</div>
                                  <div>Mickael </div>
                                </div>
                                <div>
                                  <div>
                                    <div class="gmail_extra"><br>
                                      <div class="gmail_quote">On Tue,
                                        Jun 16, 2015 at 5:11 PM, Răzvan
                                        Crainea <span dir="ltr">&lt;<a href="mailto:razvan@opensips.org" target="_blank"></a><a href="mailto:razvan@opensips.org" target="_blank">razvan@opensips.org</a>&gt;</span>
                                        wrote:<br>
                                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                          <div bgcolor="#FFFFFF" text="#000000"> <tt>Hi,
                                              Mickael!<br>
                                              <br>
                                              I don&#39;t know what exactly
                                              might cause the leak. What
                                              you can do is to try to
                                              get a core dump (using
                                              tools like gcore) during
                                              low (or unexisting)
                                              traffic and try to see
                                              what do the AVPs that are
                                              leaking contain. Are you
                                              using QM debug?<br>
                                              <br>
                                              Best regards,<br>
                                            </tt>
                                            <pre cols="72">Răzvan Crainea
OpenSIPS Solutions
<a href="http://www.opensips-solutions.com" target="_blank">www.opensips-solutions.com</a></pre>
                                            <div>
                                              <div>
                                                <div>On 05/27/2015 12:37
                                                  PM, Mickael Marrache
                                                  wrote:<br>
                                                </div>
                                                <blockquote type="cite">
                                                  <div dir="ltr">Any
                                                    idea? Is there
                                                    something that may
                                                    help finding the
                                                    leak cause?</div>
                                                  <div class="gmail_extra"><br>
                                                    <div class="gmail_quote">On
                                                      Tue, May 19, 2015
                                                      at 1:17 PM,
                                                      Mickael Marrache <span dir="ltr">&lt;<a href="mailto:mickaelmarrache@gmail.com" target="_blank"></a><a href="mailto:mickaelmarrache@gmail.com" target="_blank">mickaelmarrache@gmail.com</a>&gt;</span>
                                                      wrote:<br>
                                                      <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                                        <div dir="ltr">Any
                                                          idea what we
                                                          should do?
                                                          <div><br>
                                                          </div>
                                                          <div>I may be
                                                          doing
                                                          something
                                                          wrong but I
                                                          don&#39;t remember
                                                          I had to take
                                                          care of memory
                                                          management
                                                          when dealing
                                                          with AVPs.</div>
                                                          <div><br>
                                                          </div>
                                                          <div>Am I
                                                          right?</div>
                                                        </div>
                                                        <br>
                                                      </blockquote>
                                                    </div>
                                                  </div>
                                                </blockquote>
                                              </div>
                                            </div>
                                          </div>
                                        </blockquote>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                              </blockquote>
                            </div>
                          </div>
                        </div>
                      </div>
                    </blockquote>
                  </div>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
  </div></div></div>

<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">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>
<br></blockquote></div><br></div>