<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature 
requests.

If you have questions about using Kamailio or related to its configuration file,
ask on sr-users mailing list:

  * http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

If you have questions about developing extensions to Kamailio or its existing
C code, ask on sr-dev mailing list

  * http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Please try to fill this template as much as possible for any issue. It helps the
developers to troubleshoot the issue.

If you submit a feature request (or enhancement), you can delete the text of
the template and only add the description of what you would like to be added.

If there is no content to be filled in a section, the entire section can be 
removed.

You can delete the comments from the template sections when filling.

You can delete next line and everything above before submitting (it is a 
comment).
-->

### Description

<!--
Explain what you did, what you expected to happen, and what actually happened.
-->

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:[email protected]")

# ----- 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
<!--
If the issue can be reproduced, describe how it can be done.
-->

#### 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. 

<!--
If you got a core dump, use gdb to extract troubleshooting data - full 
backtrace,
local variables and the list of the code at the issue location.

  gdb /path/to/kamailio /path/to/corefile
  bt full
  info locals
  list

If you are familiar with gdb, feel free to attach more of what you consider to
be relevant.
-->

```
U 54.183.198.87:5060 -> 172.31.4.160:5060
INVITE sip:[email protected]: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:[email protected]>;tag=2186327.
To: <sip:[email protected]>.
Call-ID: [email protected].
CSeq: 1 INVITE.
Contact: <sip:[email protected]: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:[email protected]>;tag=2186327.
To: <sip:[email protected]>.
Call-ID: [email protected].
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:[email protected]>;tag=2185727.
To: 
<sip:[email protected]>;tag=c99e9820d9036d36e5541ff825b95248-8c22.
Call-ID: [email protected].
CSeq: 1 INVITE.
Server: kamailio (5.1.3 (x86_64/linux)).
Content-Length: 0.
.

```

#### Log Messages

<!--
Check the syslog file and if there are relevant log messages printed by 
Kamailio, add them next, or attach to issue, or provide a link to download them 
(e.g., to a pastebin site).
-->

```
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

<!--
If the issue is exposed by processing specific SIP messages, grab them with 
ngrep or save in a pcap file, then add them next, or attach to issue, or 
provide a link to download them (e.g., to a pastebin site).
-->

```
(paste your sip traffic here)
```

### Possible Solutions

<!--
If you found a solution or workaround for the issue, describe it. Ideally, 
provide a pull request with a fix.
-->

### Additional Information

  * **Kamailio Version** - output of `kamailio -v`

```
(paste your output here)
```

* **Operating System**:

<!--
Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 
16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...;
Kernel details (output of `uname -a`)
-->

```
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 or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1577
_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to