Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsonrpcs_exec for the rtpengine cache gives memory leak #1778

Closed
ovoshlook opened this issue Dec 24, 2018 · 1 comment
Closed

jsonrpcs_exec for the rtpengine cache gives memory leak #1778

ovoshlook opened this issue Dec 24, 2018 · 1 comment

Comments

@ovoshlook
Copy link
Contributor

ovoshlook commented Dec 24, 2018

Description

We are buidling some kind of our own rtpengine dispatcher based on our own algorithm using kemi Lua.

In one of the functions we are calling:

local reqBody = function(command, params)

    return json.encode({
        jsonrpc = "2.0",
        method = "rtpengine." .. command,
        params = params
    })

end

KSR.jsonrpcs.exec(reqBody("show", { "all" }))
local data = json.decode(KSR.pv.get("$jsonrpl(body)"))

And watching free_mem decrasing in case of every call of this function

If we are commenting this - nothing happens

P.S. We are doing the same for the dispatcher module but did not find memory leak for it:

local reqBody = function (command,params)

    return  json.encode( { 
        jsonrpc = "2.0", 
        method  = "dispatcher." ..command, 
        params  = params 
    } )

end

KSR.jsonrpcs.exec(reqBody( "list" ) )
local data = json.decode( KSR.pv.get("$jsonrpl(body)") )

Troubleshooting

Reproduction

To reproduce this issue suppose will be enough to call code above

Debugging Data

test results for 10000 calls total/300 per second (sipp based)

memory stats on the start

shmem:free_size = 63131408 
shmem:max_used_size = 3994704 
shmem:real_used_size = 3977456 
shmem:total_size = 67108864
shmem:used_size = 3205144

memory stats on the end ( free_size never incrases after calls. Only decrases after new call)

shmem:fragments = 5 |  
shmem:free_size = 60106232 
shmem:max_used_size = 7019952 
shmem:real_used_size = 7002632
shmem:total_size = 67108864
shmem:used_size = 4150008

Additional Information

  • Kamailio Version - output of kamailio -v
version: kamailio 5.1.6 (x86_64/linux) 7d1964
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 7d1964
compiled on 03:23:23 Oct  5 2018 with gcc 6.3.0
  • Operating System:
1 machine: SMP Debian 4.9.110-3+deb9u6 (2018-10-08) x86_64 GNU/Linux
2 machine: SMP Debian 4.9.110-3+deb9u2 (2018-08-13) x86_64 GNU/Linux

If will need any additional info just let me know
P.S. We also tried to find what can give this behavior on the rtpengine.c but didn't figured out yet

@ovoshlook
Copy link
Contributor Author

found reason
It was about
rtpeninge.rtp.manage()
we did not expect behavior that if not call manage for the BYE request - it will keep something in the memory of the kamailio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant