### Description
<!--
Kamailoi crashes every 10 hours
-->
### Troubleshooting
coredump data below.
#### Reproduction
<!--
If the issue can be reproduced, describe how it can be done.
-->
#### Debugging Data
<!--
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.
-->
```
(gdb) bt full
#0 0x000000000046ccdd in get_hash1_raw (s=0x5da51296 <Address 0x5da51296 out of bounds>, len=9) at core/hashes.h:109
p = 0x5da51296 <Address 0x5da51296 out of bounds>
v = 4100353960
h = 0
#1 0x000000000046cfb6 in str_hash_get (ht=0xa6d6c0 <cnts_hash_table>, key=0x5da51296 <Address 0x5da51296 out of bounds>, len=9) at core/str_hash.h:94
h = 0
e = 0x19
#2 0x000000000046debe in cnt_hash_lookup (group=0x7ffc2db9d7c0, name=0x7eff79693b80) at core/counters.c:420
e = 0x7eff80c48c88
first = 0xbd8191bc2e950d55
cnt_rec = 0x7eff80c48cb0
#3 0x000000000046e752 in counter_lookup_str (handle=0x7ffc2db9d7d0, group=0x7ffc2db9d7c0, name=0x7eff79693b80) at core/counters.c:541
cnt_rec = 0x19
#4 0x00007eff7d65b447 in get_stat (name=0x7eff79693b80) at ../../core/counters.h:197
h = {id = 13}
grp = {s = 0x0, len = 0}
#5 0x00007eff7d65c113 in statsc_svalue (name=0x7eff79693b80, res=0x7eff79693f4b) at statsc_mod.c:149
stat = 0xd
__FUNCTION__ = "statsc_svalue"
#6 0x00007eff7d65db79 in statsc_timer (ticks=113205942, param=0x0) at statsc_mod.c:274
sm = 0x7eff79693b70
tn = 1571099286
n = 115
__FUNCTION__ = "statsc_timer"
#7 0x00000000005db7f9 in sr_wtimer_exec (ticks=113205942, param=0x0) at core/timer_proc.c:390
wt = 0x7eff80c56f48
wn = 0x0
wp = 0x0
cs = 0
__FUNCTION__ = "sr_wtimer_exec"
#8 0x00000000005daa29 in fork_sync_timer (child_id=-1, desc=0x7c8a71 "secondary timer", make_sock=1, f=0x5db4f2 <sr_wtimer_exec>, param=0x0, interval=1000) at core/timer_proc.c:224
pid = 0
ts1 = 1811295077
ts2 = 1000
#9 0x00000000005dbb26 in sr_wtimer_start () at core/timer_proc.c:416
__FUNCTION__ = "sr_wtimer_start"
#10 0x0000000000425a33 in main_loop () at main.c:1729
i = 8
pid = 3615
si = 0x0
si_desc = "udp receiver child=7 sock=91.216.86.57:5060\000\377~\000\000@۹-\374\177\000\000\020\207A\000\000\000\000\000\020\336\271-\374\177\000\000\323c{\000\000\000\000\000\031\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\200\000\000\000\000\000__:\201\377~\000\000\250\346\260v\377~\000\000\270\314À\377~\000"
nrprocs = 8
woneinit = 1
__FUNCTION__ = "main_loop"
#11 0x000000000042c72a in main (argc=7, argv=0x7ffc2db9def8) at main.c:2696
cfg_stream = 0x1ee3010
c = -1
r = 0
tmp = 0x7ffc2db9ef2c ""
tmp_len = 0
port = 0
proto = 0
options = 0x76a9a0 ":f:cm:M:dVIhEeb:l:L:n:vKrRDTN:W:w:t:u:g:P:G:SQ:O:a:A:x:X:Y:"
ret = -1
---Type <return> to continue, or q <return> to quit--- info locals
seed = 2620966285
rfd = 4
debug_save = 0
debug_flag = 0
dont_fork_cnt = 0
n_lst = 0x2
p = 0x0
st = {st_dev = 20, st_ino = 22346, st_nlink = 2, st_mode = 16832, st_uid = 0, st_gid = 0, __pad0 = 0, st_rdev = 0, st_size = 40, st_blksize = 4096, st_blocks = 0, st_atim = {tv_sec = 1568107728, tv_nsec = 458000000}, st_mtim = {
tv_sec = 1571064422, tv_nsec = 57000000}, st_ctim = {tv_sec = 1571064422, tv_nsec = 57000000}, __unused = {0, 0, 0}}
__FUNCTION__ = "main"
(gdb) list
104 register unsigned v;
105 register unsigned h;
106
107 h=0;
108
109 hash_update_str(s, s+len, p, v, h);
110 return hash_finish(h);
111 }
112
113
```
#### 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).
-->
```
no relevant messages
```
#### 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).
-->
```
seems to be triggered by internal timer
```
### 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`
```
version: kamailio 5.2.4 (x86_64/linux) 759867
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: 759867
compiled on 12:20:22 Sep 11 2019 with gcc 4.8.5
```
* **Operating System**:
<!--
CentOS Linux release 7.4.1708 (Core)
Linux xxx 3.10.0-957.12.2.el7.x86_64 #1 SMP Tue May 14 21:24:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
-->
```
CentOS Linux release 7.4.1708 (Core)
Linux xxx 3.10.0-957.12.2.el7.x86_64 #1 SMP Tue May 14 21:24:32 UTC 2019 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/2101
Module: kamailio
Branch: master
Commit: 22558e3407a49dbf7ef84669190df0c98c8a8d58
URL: https://github.com/kamailio/kamailio/commit/22558e3407a49dbf7ef84669190df0c…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2022-01-14T09:16:13+01:00
modules: readme files regenerated - statsc ... [skip ci]
---
Modified: src/modules/statsc/README
---
Diff: https://github.com/kamailio/kamailio/commit/22558e3407a49dbf7ef84669190df0c…
Patch: https://github.com/kamailio/kamailio/commit/22558e3407a49dbf7ef84669190df0c…
---
diff --git a/src/modules/statsc/README b/src/modules/statsc/README
index 2ef41cc72d..d06f3925b2 100644
--- a/src/modules/statsc/README
+++ b/src/modules/statsc/README
@@ -103,6 +103,8 @@ modparam("statsc", "interval", 300)
How many items to store for each statistic.
+ Note: it must be set before any 'track' parameter.
+
Default value is 100.
Example 1.2. Set items parameter
Module: kamailio
Branch: master
Commit: f517f8c655e676f5872eda5f81f5244eac4eed25
URL: https://github.com/kamailio/kamailio/commit/f517f8c655e676f5872eda5f81f5244…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-01-14T09:02:39+01:00
statsc: note that items param must be set before track
---
Modified: src/modules/statsc/doc/statsc_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/f517f8c655e676f5872eda5f81f5244…
Patch: https://github.com/kamailio/kamailio/commit/f517f8c655e676f5872eda5f81f5244…
---
diff --git a/src/modules/statsc/doc/statsc_admin.xml b/src/modules/statsc/doc/statsc_admin.xml
index 9794349690..3dd6d80051 100644
--- a/src/modules/statsc/doc/statsc_admin.xml
+++ b/src/modules/statsc/doc/statsc_admin.xml
@@ -81,6 +81,9 @@ modparam("statsc", "interval", 300)
<para>
How many items to store for each statistic.
</para>
+ <para>
+ Note: it must be set before any 'track' parameter.
+ </para>
<para>
<emphasis>
Default value is 100.
### Description
As per my thread on sr-users: **Active/active keepalived - Kamailio includes non-local virtual IP in "myself" which breaks DMQ call routing**, I am seeing issues due to the behavior of `check_self` and more specifically `grep_sock_info`. I have attached a patch with a proposed new feature that would allow changing this behaviour slightly, although I've avoided changing any default behaviour.
I have a setup with keepalived in active/active mode, with two virtual IPs. The goal is that each VIP is active only one one node at a time, but in the event of a failure, both VIPs would become active on one node.
The issue I am facing is that in order for this to work, I need to have both nodes listen on both virtual IPs at all times, but this means that both nodes always consider traffic to those IPs local to themselves, even when that is not the case. This breaks many things, basically anything with `uri == myself`. But even internally in Kamailio itself, this is causing problems.
For example: PATH support is broken and this is not easily fixed in the config because `lookup()` is actually using `check_self()` internally. I am sure there are many other features which will not work right in the above scenario, and this is why I'm proposing a change in the code itself, instead of just trying to solve it in the config.
I've attached a patch file with my proposed change and would appreciate any feedback as to my overall approach. If this seems OK then I will put together a pull request for your review.
Thanks!
### Expected behavior
Kamailio should detect what IP addresses are currently active locally on it's system before considering the socket a match. If the IP is not currently there, it should ignore the match as if it is not currently listening on this IP (because it really is not!)
#### Actual observed behavior
Right now, Kamailio looks blindly at all "listen" sockets and looks for a match, regardless of if that IP is currently active locally or not, and this causes the false results of `check_self`
### Possible Solutions
As mentioned, I'm attaching a patch showing my overall approach. Basically:
* I am using pre-existing functions as much as possible for best compatibility e.g. IPv6 and IPv4.
* I use `dns_resolvehost()` which seems to have a caching function built-in and so I am hoping the performance impact of my change would be negligible.
* My code only makes a change _if_ the virtual flag is set, and if not, existing behaviour is kept so as to avoid any breaking changes.
[RT59671-kamailio-add-listen-virtual-check2.patch.txt](https://github.com/ka…
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2984
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/2984(a)github.com>