<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix"><tt>Hi Kevin,<br>
        <br>
        For debugging potential mem leaks, please look into:<br>
        &nbsp;&nbsp;&nbsp;
        <a class="moz-txt-link-freetext" href="http://www.opensips.org/Documentation/TroubleShooting-OutOfMem">http://www.opensips.org/Documentation/TroubleShooting-OutOfMem</a><br>
        If you need help with that, let me know.<br>
        <br>
        Also, cacti is monitoring the system memory which is irrelevant
        for OpenSIPS&nbsp; (as OpenSIPS is pre-allocating - from OS - all the
        needed memory at startup).<br>
        <br>
        Regards,<br>
      </tt>
      <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
      On 26.06.2014 15:04, Kevin Mathy wrote:<br>
    </div>
    <blockquote
cite="mid:CAOmzhXkwmHgCW8jeSC_qTo4pLDy11-379SEpAb06CqP45nLeQg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div
            style="font-family:arial,sans-serif;font-size:13px;font-weight:bold"><span
              style="font-weight:normal">Hi List,</span></div>
          <div
            style="font-family:arial,sans-serif;font-size:13px;font-weight:bold">
            <span style="font-weight:normal"><br>
            </span></div>
          <div
            style="font-family:arial,sans-serif;font-size:13px;font-weight:bold"><span
              style="font-weight:normal">I'm facing a memory usage issue
              with OpenSIPS 1.9.2 on a Debian 7 server</span></div>
          <div
            style="font-family:arial,sans-serif;font-size:13px;font-weight:bold"><span
              style="font-weight:normal"><br>
            </span></div>
          <div
            style="font-family:arial,sans-serif;font-size:13px;font-weight:bold"><span
              style="font-weight:normal">
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                root@asbc2:/home/kemathy# uname -a<br>
                Linux asbc2 3.2.0-4-amd64 #1 SMP Debian 3.2.57-3+deb7u2
                x86_64 GNU/Linux<br>
              </blockquote>
              <div>&nbsp;</div>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                root@asbc2:/home/kemathy# opensips -V</blockquote>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">version:
                opensips 1.9.2-notls (x86_64/linux)<br>
                flags: STATS: On, USE_IPV6, USE_TCP, DISABLE_NAGLE,
                USE_MCAST, SHM_MEM, SHM_MMAP, PKG_MALLOC, DBG_F_MALLOC,
                FAST_LOCK-ADAPTIVE_WAIT<br>
                ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144,
                MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535<br>
                poll method support: poll, epoll_lt, epoll_et, sigio_rt,
                select.<br>
                svnrevision: unknown<br>
                @(#) $Id$<br>
                main.c compiled on 11:15:37 Jun 20 2014 with gcc 4.7</blockquote>
              <div><br>
              </div>
            </span></div>
          <div
            style="font-family:arial,sans-serif;font-size:13px;font-weight:bold">
            <span style="font-weight:normal">The server handles
              something like 70000 to 90000 calls per day, with around
              20 to 40 Calls Per Second</span></div>
          <div
            style="font-family:arial,sans-serif;font-size:13px;font-weight:bold">
            <span style="font-weight:normal"><br>
            </span></div>
          <div
            style="font-family:arial,sans-serif;font-size:13px;font-weight:bold"><br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px">As
            you can see on the following Cacti graphs, system's free
            memory decreases constantly to finally reach the lower value
            of 160M :</div>
        </div>
        <div><br>
        </div>
        <a moz-do-not-send="true"
href="https://www.dropbox.com/s/np3fnc6ni4vuoet/ASBC2_Memory_Usage_Evolution.jpg">https://www.dropbox.com/s/np3fnc6ni4vuoet/ASBC2_Memory_Usage_Evolution.jpg</a>
        <div><br>
        </div>
        <div>
          <div style="font-family:arial,sans-serif;font-size:13px">
            The system can stay 2-3 days working in this state, but for
            example, yesterday evening (2014-06-25 18:50:00), opensips
            crashed, after showing those log messages :&nbsp;</div>
          <div style="font-family:arial,sans-serif;font-size:13px">
            <br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px">
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Jun
              25 18:51:18 asbc2 /usr/local/sbin/opensips[11390]:
              ERROR:db_mysql:db_mysql_convert_rows: no private memory
              left<br>
              Jun 25 18:51:18 asbc2 /usr/local/sbin/opensips[11390]:
              ERROR:core:build_res_buf_from_sip_req: out of pkg memory
              &nbsp;; needs 412<br>
              Jun 25 18:51:18 asbc2 /usr/local/sbin/opensips[11380]:
              ERROR:core:build_res_buf_from_sip_req: out of pkg memory
              &nbsp;; needs 355<br>
              Jun 25 18:51:18 asbc2 /usr/local/sbin/opensips[11380]:
              ERROR:core:received_builder: out of pkg memory<br>
              Jun 25 18:51:18 asbc2 /usr/local/sbin/opensips[11364]:
              ERROR:core:build_res_buf_from_sip_req: out of pkg memory
              &nbsp;; needs 355<br>
              Jun 25 18:51:18 asbc2 /usr/local/sbin/opensips[11364]:
              ERROR:core:add_lump_rpl: no free pkg memory !<br>
              Jun 25 18:51:18 asbc2 /usr/local/sbin/opensips[11362]:
              ERROR:core:build_res_buf_from_sip_req: out of pkg memory
              &nbsp;; needs 355<br>
              Jun 25 18:51:18 asbc2 /usr/local/sbin/opensips[11362]:
              ERROR:core:db_allocate_rows: no memory left<br>
              Jun 25 18:51:18 asbc2 /usr/local/sbin/opensips[11362]:
              ERROR:db_mysql:db_mysql_convert_rows: no private memory
              left<br>
              Jun 25 18:51:18 asbc2 /usr/local/sbin/opensips[11362]:
              ERROR:core:build_res_buf_from_sip_req: out of pkg memory
              &nbsp;; needs 412<br>
              Jun 25 18:51:18 asbc2 /usr/local/sbin/opensips[11356]:
              ERROR:core:build_res_buf_from_sip_req: out of pkg memory
              &nbsp;; needs 355<br>
              Jun 25 18:51:18 asbc2 /usr/local/sbin/opensips[11356]:
              ERROR:core:add_lump_rpl: no free pkg memory !<br>
            </blockquote>
            <div><br>
            </div>
            <div>And after the service's restart, everything was OK :&nbsp;</div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Jun
              25 19:12:39 asbc2 /usr/local/sbin/opensips[29351]:
              <a class="moz-txt-link-freetext" href="INFO:core:main">INFO:core:main</a>: using 64 Mb shared memory<br>
              Jun 25 19:12:39 asbc2 /usr/local/sbin/opensips[29351]:
              <a class="moz-txt-link-freetext" href="INFO:core:main">INFO:core:main</a>: using 4 Mb private memory per process</blockquote>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px"><br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px"><br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px">For
            information, here are the memory values at this moment;
            opensips has handled 5000 calls since his bootup :</div>
          <div style="font-family:arial,sans-serif;font-size:13px">
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">root@asbc2:/home/kemathy#
              free -m<br>
              &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;total &nbsp; &nbsp; &nbsp; used &nbsp; &nbsp; &nbsp; free &nbsp; &nbsp; shared &nbsp;
              &nbsp;buffers &nbsp; &nbsp; cached<br>
              Mem: &nbsp; &nbsp; &nbsp; &nbsp; 16082 &nbsp; &nbsp; &nbsp;12887 &nbsp; &nbsp; &nbsp; 3195 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;
              &nbsp;339 &nbsp; &nbsp; &nbsp;11393<br>
              -/+ buffers/cache: &nbsp; &nbsp; &nbsp; 1154 &nbsp; &nbsp; &nbsp;14928<br>
              Swap: &nbsp; &nbsp; &nbsp; &nbsp;32755 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp;32755</blockquote>
            <div><br>
            </div>
            <div>&nbsp;</div>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px">For
            now, OpenSIPS is launched with S_MEMORY = 64 and P_MEMORY =
            4</div>
          <div style="font-family:arial,sans-serif;font-size:13px">My
            first idea would be to increase the P_MEMORY value to 8 for
            example, as it seems to be a lack of PKG Memory, but in case
            it's a memory-freeing problem, it'll not solve our issue (I
            think).</div>
          <div style="font-family:arial,sans-serif;font-size:13px"><br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px">My
            questions are : How can we calculate the appropriate value
            for S_MEMORY and P_MEMORY ? And how can we solve our "out of
            pkg memory" problem ?&nbsp;</div>
          <div style="font-family:arial,sans-serif;font-size:13px"><br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px">If
            you need further informations, or anything else, feel free
            to ask me !</div>
          <div style="font-family:arial,sans-serif;font-size:13px">
            <br>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px">Thanks
            a lot for your help,&nbsp;</div>
        </div>
        <div><br clear="all">
          <div><b>
              <div><span style="font-weight:normal">Bien cordialement,&nbsp;</span></div>
              <div><span style="font-weight:normal">Best Regards,&nbsp;</span></div>
              <div><span style="font-weight:normal"><br>
                </span></div>
            </b><b>Kevin MATHY</b> |<b>&nbsp;</b>Ing&eacute;nieur VoIP<br>
            <div>
              <div><b><br>
                </b></div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <img moz-do-not-send="true"
src="http://www.hexanet.fr/sites/files/hexanet/files/utilities/signature_hexanet.gif"><br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>