[asterisk-bugs] [JIRA] (ASTERISK-27305) res_ari: Memory leaks in ARI when using Content-Type: application/json

David Hajek (JIRA) noreply at issues.asterisk.org
Thu Oct 5 08:01:38 CDT 2017


     [ https://issues.asterisk.org/jira/browse/ASTERISK-27305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Hajek updated ASTERISK-27305:
-----------------------------------

    Attachment: json_memory_fix.patch

I think this patch fixes the memory leak. I tried many thousands API ARI calls and there are no leaks. Please review. 

> res_ari: Memory leaks in ARI when using Content-Type: application/json
> ----------------------------------------------------------------------
>
>                 Key: ASTERISK-27305
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27305
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>    Affects Versions: 13.17.2, 14.6.2, 15.0.0-rc1
>         Environment: CentOS 6.9, jansson 2.9
>            Reporter: David Hajek
>         Attachments: json_memory_fix.patch, mmlog, mmlog.txt
>
>
> There is some memory leak when making ARI request with Content-Type: application/json. Every such call leaks few bytes of memory in json.c and its never freed. Making several thousands ARI requests results in asterisk being killed by kernel's OOM. Memory is not leaked when Content-Type application/json is not used. 
> We don't think this is duplicate of ASTERISK-27067.
> We tried latest 13.17.2, 14.6.2 and 15.0.0 and all these versions are affected.
> Steps to reproduce:
> # Run asterisk with MALLOC_DEBUG
> # Memory allocations in json.c after startup
> {code}
> asterisk  -rx 'memory show summary' | grep json.c
> 672 bytes in          5 allocations in file json.c
> {code}
> # Originate dummy call using ARI
> {code}
> curl -v -u ari:asterisk -X POST -H "Content-Type: application/json" "http://localhost:8088/ari/channels" -d '{"endpoint":"SIP/dummy", "extension":"123456", "context":"internal-routing", "priority":"1"}'
> {code}
> # Memory allocations in json.c after one ARI call. This memory is never freed and many requests results in OOM.
> {code}
> asterisk  -rx 'memory show summary' | grep json.c
>       2288 bytes in         19 allocations in file json.c
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list