net/asterisk13: memory leak under 12-CURRENT?
Guido Falsi
madpilot at FreeBSD.org
Thu Sep 28 07:39:03 UTC 2017
On 09/28/2017 08:11, O. Hartmann wrote:
> On Wed, 27 Sep 2017 09:05:42 +0200
> Guido Falsi <madpilot at FreeBSD.org> wrote:
>
>> On 09/26/2017 15:41, O. Hartmann wrote:
>>> On Tue, 26 Sep 2017 15:06:23 +0200
>>> Guido Falsi <madpilot at FreeBSD.org> wrote:
>>
>>> Since I run net/asterisk with automatic module loading (I'm new to
>>> asterisk), this is very likely and might cause the problem somehow.
>>>
>>
>> You can exclude single modules from autoloading via modules.conf.
>>
>>>> Not sure, restarting the daemon should free any leaked memory the daemon
>>>> has. If a killed process leaves memory locked at the system level there
>>>> should be some other cause.
>>>
>>> Even with no runnidng asterisk, memory level drops after the last shutdown
>>> of asterisk and keeps that low. Even for weeks! My router never shows that
>>> high memory consumption, even under load.
>>
>> But while asterisk is running does the memory usage increase unbounded
>> till filling all available memory or does it stabilize at some point?
>
> While Asterisk is running, it doesn't consume much memory, but stopping
> Asterisk, I would expect that the claimed memory is freed again. It isn't, not
> all memory is freed. Starting Asterisk then again from this reduced memory
> level, it claims its memory, "stabilzes" at a certain point while running and
> again, stopping Asterisk leaves the free memory now at a much lower level never
> been leveld out - as I said.
>
> I played this game last night ~ 20 times until the free memory dropped beneath
> 3 GB after asterisk has been shut down. This morning, the level was at the same
> low level as I left it. The router has nothing special to do, the workload is
> not memory consuming even for weeks! And if there is load, after the load went
> away, the memory consumption always leveld out and freed memory.
>>
>> Asterisk is relatively memory hungry, especially with all modules
>> enabled. It also caches and logs various information in RAM, even doing
>> "nothing" it will cache and log that "nothing" activity. If memory does
>> stabilize after some point it's not really a leak but it's standard
>> memory usage. To reduce it you should disable all unused modules.
>
> I don't understand here. Even if Asterisk is memory hungry - it has ~ 3 GB to
> use. But after stopping it, it should free the memory. BUT the system is then
> after the stop with less memory! that is the point. Not the running asterisk's
> memory consumption bothers me, but the fact, that after 20 start and stops and
> waiting for days the memory once gone is never put back.
VM system is not composed only of "free" and "used" ram, there ar3e
other categories. Depending on how a program allocates and uses memory
it's not automatically sent to the "free" pool after being reclaimed.
Allocated memory can be dirty buffers which are reclaimed after time, or
other types of buffered data which is never reclaimed until there is
memor7y pressure. How do you know the game you were playing has a
similar memory usage as asterisk, which, I assure you, has some complex
memory usage patterns in it's source.
Also asterisk leverages many parts of the kernel which a game does not
leverage. I'm quite sure after quitting asterisk you have an higher
"wired" memory than before starting it. That memory was not allocated by
asterisk itself, but by the kernel while "serving" asterisk requests.
The kernel keeps running and does not free that memory right away. in
fact will not free it until forced by VM pressure AFAIK.
But this is quite a complicated matter and not being a VM expert I can't
explain it in detail. What you must understand is that many things are
going on at a given time in a memory subsystem and looking at it through
a single value is not indicative.
>
> At the moment, I have mpg123 suspect doing nasty things, because the
> vanishing memory is more prominent and indicated when voicemail system has
> been used and mpg123 started. Not touching VM subsystem seems to free the
> whole memory claimed by asterisk after stopping asterisk, apart from maybe
> buffers claimed by the OS released later (I did no thourough investigations on
> that).
Please note that when I use the "VM" Acronym I mean "Virtual Memory".
there is a new version of mpg123 also, and I'm quite sure that mpg123
causes caching of the audio data it reads. Adsterisk Voicemail system
also causes caching. Those cached are not going to be freed after
program exit because other programs could take advantage of the cached data.
I'm not understanding what you are expecting us to do based on
circumstantial and partial data.
--
Guido Falsi <madpilot at FreeBSD.org>
More information about the freebsd-current
mailing list