<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> </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 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 : </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 ; 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 ; 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 ; 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 ; 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 ; 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 ; 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 : </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]: INFO:core:main: using 64 Mb shared memory<br>Jun 25 19:12:39 asbc2 /usr/local/sbin/opensips[29351]: INFO:core:main: 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>
total used free shared buffers cached<br>Mem: 16082 12887 3195 0 339 11393<br>-/+ buffers/cache: 1154 14928<br>Swap: 32755 0 32755</blockquote>
<div><br></div><div> </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 ? </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, </div></div><div><br clear="all"><div><b><div><span style="font-weight:normal">Bien cordialement, </span></div><div><span style="font-weight:normal">Best Regards, </span></div>
<div><span style="font-weight:normal"><br></span></div></b><b>Kevin MATHY</b> |<b> </b>Ingénieur VoIP<br><div><div><b><br></b></div></div></div>
</div></div>
<br>
<img src="http://www.hexanet.fr/sites/files/hexanet/files/utilities/signature_hexanet.gif">