Description

We are using lua base routing with app_lua. We are seeing that our memory-utilization on that system continuously getting increase. our route.lua will have all routing logic same as

https://github.com/kamailio/kamailio/blob/master/misc/examples/kemi/kamailio-basic-kemi-lua.lua

we are using following set of modules
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "tmx.so"
loadmodule "sl.so"
loadmodule "maxfwd.so"
loadmodule "nathelper.so"
loadmodule "textops.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "sanity.so"
loadmodule "path.so"
loadmodule "jsonrpcs.so"
loadmodule "app_lua.so"
loadmodule "dispatcher.so"
loadmodule "json.so"
loadmodule "cfg_rpc.so"
loadmodule "ctl.so"
loadmodule "ipops.so"
loadmodule "http_async_client.so"
loadmodule "dialog.so"

----------------- setting module-specific parameters ---------------

----- rr params -----

set next param to 1 to add value to ;lr param (helps with some UAs)

modparam("rr", "enable_full_lr", 0)

do not append from tag to the RR (no need for this script)

modparam("rr", "append_fromtag", 1)

----- dispatcher params -----

modparam("dispatcher", "list_file", DISPATCHER_FILE)
modparam("dispatcher", "ds_probing_mode", 1)
modparam("dispatcher", "flags", 2)
modparam("dispatcher", "ds_ping_interval", 10)
modparam("dispatcher", "ds_ping_from", "sip:ping@test.com")

----- nathelper params ----

modparam("nathelper", "received_avp", "$avp(s:rcv)")

----- http_async_client -------

---- number of worker process for async req and res

modparam("http_async_client", "workers", 4)

----- ctl ------

modparam("ctl", "binrpc", "tcp:MY_IP_ADDR:2086")

----- app_lua params ----

modparam("app_lua", "reload", 1)
modparam("app_lua", "load", ROUTE_LUA)

---- dialog params ----

modparam("dialog", "enable_stats", 1)
modparam("dialog", "dlg_flag", 4)
modparam("dialog", "event_callback", "ksr_dialog_event")

cfgengine "lua"

Troubleshooting

Reproduction

We can easily reproduce by loading app_lua with kamailio-basic-kemi-lua.lua

https://github.com/kamailio/kamailio/blob/master/misc/examples/kemi/kamailio-basic-kemi-lua.lua

Debugging Data

root@ip-172-31-4-160:~# kamcmd -s tcp:172.31.4.160:2046 tm.stats
{
current: 2220
waiting: 2198
total: 6113169
total_local: 1371
rpl_received: 11958486
rpl_generated: 6111711
rpl_sent: 12224635
6xx: 0
5xx: 6104789
4xx: 6831
3xx: 0
2xx: 1483
created: 6113169
freed: 6110949
delayed_free: 0
}

transaction are getting free as they are created so no transaction memory leak.

U 54.183.198.87:5060 -> 172.31.4.160:5060
INVITE sip:919980950111@13.57.122.212:5060 SIP/2.0.
Record-Route: <sip:54.183.198.87;lr;ftag=2186327>.
Via: SIP/2.0/UDP 54.183.198.87:5060;branch=z9hG4bK62f3.22dfb9a43503cc12dafdcdbc9ab1e17d.0.
Via: SIP/2.0/UDP 172.31.13.202:5060;rport=5060;received=13.232.78.75;branch=z9hG4bK-20254-2186327-0.
From: <sip:919980950111@21979254854757081.zt.plivo.com>;tag=2186327.
To: <sip:919980950111@21979254854757081.zt.plivo.com>.
Call-ID: 2186327-20254@172.31.13.202.
CSeq: 1 INVITE.
Contact: <sip:sipp@13.126.252.148:5060;transport=UDP;alias=13.232.78.75~5060~1>.
Max-Forwards: 69.
User-Agent: Sipp/Linux.
Supported: replaces, outbound.
Content-Type: application/sdp.
Content-Length:   139.
X-ZT-Cust-IP: 13.232.78.75.
X-ZT-Trunk: 21979254854757081.zt.plivo.com.
.
v=0.
o=user1 53655765 2353687637 IN IP4 13.126.252.148.
s=-.
c=IN IP4 13.126.252.148.
t=0 0.
m=audio 6000 RTP/AVP 0.
a=rtpmap:0 PCMU/8000.

#
U 172.31.4.160:5060 -> 54.183.198.87:5060
SIP/2.0 100 trying -- your call is important to us.
Via: SIP/2.0/UDP 54.183.198.87:5060;branch=z9hG4bK62f3.22dfb9a43503cc12dafdcdbc9ab1e17d.0;rport=5060.
Via: SIP/2.0/UDP 172.31.13.202:5060;rport=5060;received=13.232.78.75;branch=z9hG4bK-20254-2186327-0.
From: <sip:919980950111@21979254854757081.zt.plivo.com>;tag=2186327.
To: <sip:919980950111@21979254854757081.zt.plivo.com>.
Call-ID: 2186327-20254@172.31.13.202.
CSeq: 1 INVITE.
Server: kamailio (5.1.3 (x86_64/linux)).
Content-Length: 0.
.

#
U 172.31.4.160:5060 -> 54.183.198.87:5060
SIP/2.0 408 Request Timeout.
Via: SIP/2.0/UDP 54.183.198.87:5060;branch=z9hG4bK223b.cd9c3cb1d2dc6adc346e6fb7acdee708.0;rport=5060.
Via: SIP/2.0/UDP 172.31.13.202:5060;rport=5060;received=13.232.78.75;branch=z9hG4bK-20254-2185727-0.
From: <sip:919980950111@21979254854757081.zt.plivo.com>;tag=2185727.
To: <sip:919980950111@21979254854757081.zt.plivo.com>;tag=c99e9820d9036d36e5541ff825b95248-8c22.
Call-ID: 2185727-20254@172.31.13.202.
CSeq: 1 INVITE.
Server: kamailio (5.1.3 (x86_64/linux)).
Content-Length: 0.
.

Log Messages

Jun 29 19:18:14 ip-172-31-4-160 kamailio[8119]: ERROR: <core> [core/mem/q_malloc.c:287]: qm_find_free(): qm_find_free(0x7fe974b24000, 35992); Free fragment not found!
Jun 29 19:18:14 ip-172-31-4-160 kamailio[8119]: ERROR: <core> [core/mem/q_malloc.c:421]: qm_malloc(): qm_malloc(0x7fe974b24000, 35992) called from http_async_client: http_multi.c: curl_shm_calloc(346), module: http_async_client; Free fragment not found!
Jun 29 19:18:14 ip-172-31-4-160 kamailio[8119]: ERROR: http_async_client [http_multi.c:437]: new_request(): curl_easy_init() failed!

SIP Traffic

(paste your sip traffic here)

Possible Solutions

Additional Information

(paste your output here)
root@ip-172-31-4-160:/etc/kamailio# uname -a
Linux ip-172-31-4-160 3.13.0-143-generic #192-Ubuntu SMP Tue Feb 27 10:45:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.