### Description
Periodically Kamailio crashes, log shows that it happens on REGISTER request with incorrect params. I don't know if it is a network problem or somebody sends incorrect request, but there are records in logs:
#### Log Messages
Jan 30 03:49:29 kam /usr/sbin/kamailio[20718]: ERROR: <core> [core/parser/parse_from.c:53]: parse_from_header(): bad msg or missing FROM header
Jan 30 03:49:29 kam /usr/sbin/kamailio[20718]: ERROR: dialog [dlg_cseq.c:93]: dlg_cseq_prepare_msg(): cannot parse FROM header
Jan 30 03:49:29 kam /usr/sbin/kamailio[20718]: ERROR: pv [pv_core.c:664]: pv_get_callid(): cannot parse Call-Id header
Jan 30 03:49:29 kam /usr/sbin/kamailio[20718]: {1 <null> <null>} ERROR: <core> [core/parser/parse_from.c:53]: parse_from_header(): bad msg or missing FROM header
Jan 30 03:49:29 kam /usr/sbin/kamailio[20718]: {1 <null> <null>} ERROR: pv [pv_core.c:468]: pv_get_from_attr(): cannot parse From header
Jan 30 03:49:29 kam /usr/sbin/kamailio[20718]: {1 <null> <null>} ERROR: pv [pv_core.c:664]: pv_get_callid(): cannot parse Call-Id header
Jan 30 03:49:29 kam /usr/sbin/kamailio[20718]: {1 <null> <null>} NOTICE: <script>: REQ: M='REGISTER sip:1.2.3.208:5060' F='<null>' T='<null>' CI='<null>' SRC='113.128.105.127:49556' AU='<null>'
Jan 30 03:49:29 kam /usr/sbin/kamailio[20736]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 15
Jan 30 03:49:29 kam /usr/sbin/kamailio[20713]: ALERT: <core> [main.c:746]: handle_sigs(): child process 20718 exited by a signal 11
Jan 30 03:49:29 kam /usr/sbin/kamailio[20713]: ALERT: <core> [main.c:749]: handle_sigs(): core was not generated
Jan 30 03:49:29 kam /usr/sbin/kamailio[20713]: INFO: <core> [main.c:771]: handle_sigs(): terminating due to SIGCHLD
### Additional Information
version: kamailio 5.2.0-dev2 (i386/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, 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_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 4.9.2
* **Operating System**:
Linux kam 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) 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/1420
I was trying to do a cfg_rpc update on a variable and some of the times, the variable would take on randomly large values or negative values.
The -1 here is probably causing issues.
https://github.com/kamailio/kamailio/blob/1d53ea3dba4e59b05b2e92ecc973c4415…
Here's an explanation of what's going on (debugged using gdb). In cfg_struc.c if you put a breakpoint in the following line in cfg_clone_global
https://github.com/kamailio/kamailio/blob/1d53ea3dba4e59b05b2e92ecc973c4415…
checking variable values:
```
--- Old (correct) value ---
(gdb) print sizeof(*(int *)(((unsigned char *)((*cfg_global)->vars + 984)) + 172))
$33 = 4
(gdb) print *((unsigned char *)&(*(int *)(((unsigned char *)((*cfg_global)->vars + 984)) + 172)) + 0)
$34 = 99 'c'
(gdb) print *((unsigned char *)&(*(int *)(((unsigned char *)((*cfg_global)->vars + 984)) + 172)) + 1)
$35 = 0 '\000'
(gdb) print *((unsigned char *)&(*(int *)(((unsigned char *)((*cfg_global)->vars + 984)) + 172)) + 2)
$36 = 0 '\000'
(gdb) print *((unsigned char *)&(*(int *)(((unsigned char *)((*cfg_global)->vars + 984)) + 172)) + 3)
$37 = 0 '\000'
--- new (corrupt) value ---
(gdb) print sizeof(*(int *)(((unsigned char *)((block)->vars + 984)) + 172))
$28 = 4
(gdb) print *((unsigned char *)&(*(int *)(((unsigned char *)((block)->vars + 984)) + 172)) + 0)
$29 = 99 'c'
(gdb) print *((unsigned char *)&(*(int *)(((unsigned char *)((block)->vars + 984)) + 172)) + 1)
$30 = 0 '\000'
(gdb) print *((unsigned char *)&(*(int *)(((unsigned char *)((block)->vars + 984)) + 172)) + 2)
$31 = 0 '\000'
(gdb) print *((unsigned char *)&(*(int *)(((unsigned char *)((block)->vars + 984)) + 172)) + 3)
$32 = 130 '\202'
```
As visible, the last byte is getting corrupted.
I checked the memory allocation variables:
```
--> cfg_block_size
(gdb) print cfg_block_size
$2 = 1156
--> sizeof(cfg_block_t)
print sizeof(cfg_block_t)
$15 = 8
```
This means that total memory assigned = 8 + 1156 -(1) = 1163
```
--> address of new block
(gdb) print (void *) block
$12 = (void *) 0x7f63086b6758
--> address of the corrupted variable in the new block
(gdb) print (void *)(((unsigned char *)((block)->vars + 984)) + 172)
$13 = (void *) 0x7f63086b6be0
--> offset of the variable from the block start
(gdb) print 0x7f63086b6be0 - 0x7f63086b6758
$14 = 1160
```
since the variable is an integer, memory that should be assigned = 1160 + 4 = 1164
However, we're assigning 1163.
Therefore the last byte is getting corrupted.
Does it make sense to remove the -1 from all the memory allocation in cfg_struct ?
--
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/1583
<!--
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/kamaili…
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/kamaili…
<!--
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: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(a)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(a)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(a)172.31.13.202.
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
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1086
-- Commit Summary --
* pkg/kamailio: Fix of ticket 1085
-- File Changes --
M pkg/kamailio/centos/7/kamailio.service (2)
M pkg/kamailio/deb/debian/kamailio.service (2)
M pkg/kamailio/deb/jessie/kamailio.service (2)
M pkg/kamailio/deb/sid/kamailio.service (2)
M pkg/kamailio/deb/stretch/kamailio.service (2)
M pkg/kamailio/deb/xenial/kamailio.service (2)
M pkg/kamailio/fedora/17/kamailio.service (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1086.patchhttps://github.com/kamailio/kamailio/pull/1086.diff
--
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/pull/1086
(Feature request)
be able to recover data from htable variable when kamailio starts, from another kamailio instances through dmq module.
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/260
Apparently the default locks are set to PTHREAD mutex, when the architecture is not handled explicitely. It should be reviewed and eventually switch to standard POSIX, they should work everywhere while PTHREAD are targeting threads and work only in few cases for processes.
--
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/1035
repro servers peer with each other in a federated manner just like SMTP servers for email, but using TLS mutual authentication to prevent impersonation.
Kamailio has TLS support and should be able to talk to such servers and other Kamailio servers in the same way.
It would be good to create a recommended sample configuration for this type of service and also add it to the RTC Quick Start Guide:
http://rtcquickstart.org/guide/multi/sip-proxy.html
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/531