[Home]

Summary:ASTERISK-26731: res_sorcery_memory_cache: memory leak on every sorcery memory cache populate
Reporter:Ustinov Artem (artem198315@gmail.com)Labels:
Date Opened:2017-01-19 03:08:46.000-0600Date Closed:2017-01-24 12:45:18.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:Resources/res_sorcery_memory_cache
Versions:13.13.1 Frequency of
Occurrence
Constant
Related
Issues:
Environment: 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 GNU/LinuxAttachments:( 0) endpoint_acl_leak.diff
( 1) valgrind.tar.gz
Description:Configured PJSIP realtime with sorcery cache (full_backend_cache=yes).

After each 'sorcery memory cache expire/populate res_pjsip/endpoint' command or when sorcery memory cache expires extra memory consumption occur.
I have around 6000 endpoints and each time that cache expires and sorcery repopulate it memory consumption rises about 50 mb.

I attached valgrind log.

{noformat}
Sorcery.conf
[res_pjsip] ; Realtime PJSIP configuration wizard
endpoint/cache=memory_cache,maximum_objects=0,expire_on_reload=no,object_lifetime_stale=0,object_lifetime_maximum=600,full_backend_cache=yes
auth/cache=memory_cache,maximum_objects=0,expire_on_reload=no,object_lifetime_stale=0,object_lifetime_maximum=600,full_backend_cache=yes
aor/cache=memory_cache,maximum_objects=0,expire_on_reload=no,object_lifetime_stale=0,object_lifetime_maximum=86400,full_backend_cache=yes

endpoint=config,pjsip.conf,criteria=type=endpoint
auth=config,pjsip.conf,criteria=type=auth
aor=config,pjsip.conf,criteria=type=aor
domain=config,pjsip.conf,criteria=type=domain

endpoint=realtime,ps_endpoints
auth=realtime,ps_auths
aor=realtime,ps_aors
{noformat}
Comments:By: Asterisk Team (asteriskteam) 2017-01-19 03:08:48.336-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Mark Michelson (mmichelson) 2017-01-23 16:16:00.388-0600

It looks like we're not freeing ACLs when destroying a PJSIP endpoint. I will attach a patch here and put it up for review as well. If you can test the patch, that would be great. I think most of the "possibly lost" records in the valgrind output are not a problem, but the ACL leaks are really bad.

By: Mark Michelson (mmichelson) 2017-01-23 16:29:10.678-0600

Here is the patch that frees ACLs on PJSIP endpoints.

The change is also up for review at https://gerrit.asterisk.org/#/c/4772/

By: Ustinov Artem (artem198315@gmail.com) 2017-01-24 04:14:31.610-0600

i tried this patch and problem disappeared. No side effects detected

By: Friendly Automation (friendly-automation) 2017-01-24 12:45:19.794-0600

Change 4773 merged by Joshua Colp:
Free endpoint ACLs when destroying PJSIP endpoints.

[https://gerrit.asterisk.org/4773|https://gerrit.asterisk.org/4773]

By: Friendly Automation (friendly-automation) 2017-01-24 12:46:04.289-0600

Change 4774 merged by Joshua Colp:
Free endpoint ACLs when destroying PJSIP endpoints.

[https://gerrit.asterisk.org/4774|https://gerrit.asterisk.org/4774]

By: Friendly Automation (friendly-automation) 2017-01-24 15:50:00.391-0600

Change 4772 merged by George Joseph:
Free endpoint ACLs when destroying PJSIP endpoints.

[https://gerrit.asterisk.org/4772|https://gerrit.asterisk.org/4772]