<div><div><a href="https://issues.asterisk.org/jira/browse/ASTERISK-28695">https://issues.asterisk.org/jira/browse/ASTERISK-28695</a></div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 25, 2020 at 2:32 PM hw <<a href="mailto:hw@gc-24.de">hw@gc-24.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><br><br>Hi,<br><br><br><br>ever since I have switched my server from Centos 7 to Fedora 32, asterisk<br><br>is showing memory issues and no calls are possible.  I'm using the asterisk<br><br>that comes with Fedora; before that, I used a self-compiled version on<br><br>Centos.  The hardware is still the same.  Asterisk shows the following<br><br>message when trying to make a call:<br><br><br><br><br><br>WARNING[92530]: pbx.c:4644 increase_call_count: Available system memory<br><br>(~168MB) is below the configured low watermark (1024MB)<br><br><br><br><br><br>I was thinking that asterisk is leaking memory because the only way to get<br><br>asterisk to work again was by restarting the server.  Since this is very<br><br>annoying and the Fedora bug report remains ignored, I finally started to<br><br>investigate.  The relevant source is attached in asnip.c.<br><br><br><br>To see what's going on, I wrote a test program, attached as sysinfo.c.  You<br><br>can simply compile it with 'cc -O2 sysinfo.c -o sysinfo'.<br><br><br><br>The output is follows:<br><br><br><br><br><br>./sysinfo <br><br>unit size:                 1 byte(s)<br><br>#<br><br>freeram:                 153<br><br>bufferram:                 5<br><br>----<br><br>Sum:                     158<br><br>#<br><br>trying to allocate 158<br><br>sleeping 5 seconds<br><br>allocate twice as much<br><br>sleeping 5 seconds<br><br>memset allocated memory to 0<br><br>sleeping 5 seconds<br><br>memory freed<br><br><br><br><br><br>So what asterisk says is about right.  When I look at the info from 'cat<br><br>/proc/meminfo', I see this:<br><br><br><br><br><br>cat /proc/meminfo <br><br>MemTotal:       16361780 kB<br><br>MemFree:          151844 kB<br><br>MemAvailable:   14883060 kB<br><br>Buffers:            5468 kB<br><br>Cached:         14773136 kB<br><br>SwapCached:          224 kB<br><br>Active:          2019568 kB<br><br>Inactive:       13592124 kB<br><br>[...]<br><br><br><br><br><br>which would mean that I have 14GB buffered/cached, and 'free -h' confirms<br><br>this.<br><br><br><br>Apparently, the cache remains persistently occupied.  Since I'm currently<br><br>performing backups, it's not surprising that the cache is large.<br><br> Apparently it means that asterisk fails every time I'm doing something<br><br>that fills the cache :(<br><br><br><br>After understanding that the cache remains full, I figured there might be<br><br>way to flush the buffers and the cache.  [1] shows how to do this, and<br><br>after 'sync; echo 3 > /proc/sys/vm/drop_caches', 'free -h' showed<br><br>buff/cache as 1.3Gi and asterisk was working again.<br><br><br><br>However, the backups are still going on, and it doesn't take long before<br><br>the cache is back at 14GB again and asterisk is blocked.<br><br><br><br>I think asterisk needs to consider the cache as free memory as well.  Isn't<br><br>the cache supposed to automatically shrink when more memory is required?<br><br><br><br>As a workaround, I can set minmemfree in asterisk.conf to a low value.<br><br> Nonetheless, I guess that should be fixed.  I'll update the Fedora bug<br><br>report with this.<br><br><br><br><br><br>[1]: <br><br><a href="https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/" rel="noreferrer" target="_blank">https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/</a><br><br><br><br>-- <br><br>_____________________________________________________________________<br><br>-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" rel="noreferrer" target="_blank">http://www.api-digital.com</a> --<br><br><br><br>Check out the new Asterisk community forum at: <a href="https://community.asterisk.org/" rel="noreferrer" target="_blank">https://community.asterisk.org/</a><br><br><br><br>New to Asterisk? Start here:<br><br>      <a href="https://wiki.asterisk.org/wiki/display/AST/Getting+Started" rel="noreferrer" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Getting+Started</a><br><br><br><br>asterisk-users mailing list<br><br>To UNSUBSCRIBE or update options visit:<br><br>   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" rel="noreferrer" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a></blockquote></div></div>