### Description
After upgrading to 5.3.0 from 5.2.2 (standard packages on FreeBSD 12.0), I am experiencing intermittent crashes related to handling of BYE messages.
### Troubleshooting
#### Reproduction
This happens ~ weekly and I have not found a good way to reproduce it.
#### Debugging Data
An example backtrace is below from the last dumped core (the SIGSEGV one); unfortunately it overwrote the earlier one:
```
* thread #1, name = 'kamailio', stop reason = signal SIGSEGV
* frame #0: 0x00000008009c5b79 libc.so.7`___lldb_unnamed_symbol403$$libc.so.7 + 41
frame #1: 0x00000008009ed63e libc.so.7`__free + 990
frame #2: 0x000000080271562b libthr.so.3`pthread_rwlock_destroy + 59
frame #3: 0x0000000802bedbf6 libcrypto.so.111`CRYPTO_THREAD_lock_free + 22
frame #4: 0x0000000802aef3c4 libcrypto.so.111`RSA_free + 100
frame #5: 0x0000000802b10c32 libcrypto.so.111`EVP_PKEY_free + 66
frame #6: 0x000000080296ed86 libssl.so.111`___lldb_unnamed_symbol646$$libssl.so.111 + 134
frame #7: 0x000000080295f93c libssl.so.111`SSL_CTX_free + 236
frame #8: 0x00000008028aee42 tls.so`tls_free_domain + 114
frame #9: 0x00000008028af1d7 tls.so`tls_free_cfg + 199
frame #10: 0x00000008028af2df tls.so`tls_destroy_cfg + 191
frame #11: 0x00000008028ad1f1 tls.so`destroy_tls_h + 1185
frame #12: 0x000000000041adea kamailio`destroy_tls + 26
frame #13: 0x00000000002e36fd kamailio`cleanup + 269
frame #14: 0x00000000002eb5b7 kamailio`___lldb_unnamed_symbol5$$kamailio + 1351
frame #15: 0x00000000002ea5e5 kamailio`handle_sigs + 21669
frame #16: 0x00000000002fb83e kamailio`main_loop + 40014
frame #17: 0x0000000000307d2b kamailio`main + 50267
frame #18: 0x00000000002e311b kamailio`_start + 283
```
This is with OpenSSL 1.1 With the LD_PRELOAD hack to 5.2.2, things were completely stable; I am trying to use kamailio without the LD_PRELOAD'ed mutex wrapper now, which I believe is no longer required. It looks like the SSL-related stuff in the TLS crash (which was 5 minutes later!) is unrelated to the initial problem and may just be an artifact of one of the kamailio processes crashing earlier.
#### Log Messages
```
Nov 2 08:11:31 home /usr/local/sbin/kamailio[94702]: CRITICAL: {1 527440 BYE 973470944-5061-16392(a)BA.A.B.I} <core> [core/mem/q_malloc.c:149]: qm_debug_check_frag(): BUG: qm: prev. fragm. tail overwritten(c0c0c000, abcdefed)[0x801544c58:0x801544c90]! Memory allocator was called from core: core/action.c:754. Fragment marked by core: core/dset.c:733. Exec from core/mem/q_malloc.c:504.
Nov 2 08:13:41 home /usr/local/sbin/kamailio[94703]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 22
Nov 2 08:13:41 home kernel: pid 94702 (kamailio), uid 0: exited on signal 6 (core dumped)
Nov 2 08:13:41 home /usr/local/sbin/kamailio[94692]: ALERT: <core> [main.c:767]: handle_sigs(): child process 94702 exited by a signal 6
Nov 2 08:13:41 home /usr/local/sbin/kamailio[94692]: ALERT: <core> [main.c:770]: handle_sigs(): core was generated
Nov 2 08:14:56 home login[8284]: ROOT LOGIN (root) ON ttyu0
Nov 2 08:16:26 home kernel: pid 94692 (kamailio), uid 0: exited on signal 11 (core dumped)
```
I had an identical problem a week ago, also with a crash on a BYE for an active call:
```
Oct 27 13:00:02 home /usr/local/sbin/kamailio[79819]: CRITICAL: {1 598425 BYE 649761149-5061-291(a)BA.A.B.I} <core> [core/mem/q_malloc.c:149]: qm_debug_check_frag(): BUG: qm: prev. fragm. tail overwritten(c0c0c000, abcdefed)[0x801551808:0x801551840]! Memory allocator was called from core: core/action.c:754. Fragment marked by core: core/dset.c:733. Exec from core/mem/q_malloc.c:504.
Oct 27 13:02:09 home /usr/local/sbin/kamailio[79820]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 22
Oct 27 13:02:09 home kernel: pid 79819 (kamailio), uid 0: exited on signal 6 (core dumped)
Oct 27 13:02:09 home /usr/local/sbin/kamailio[79809]: ALERT: <core> [main.c:767]: handle_sigs(): child process 79819 exited by a signal 6
Oct 27 13:02:09 home /usr/local/sbin/kamailio[79809]: ALERT: <core> [main.c:770]: handle_sigs(): core was generated
Oct 27 13:04:55 home kernel: pid 79809 (kamailio), uid 0: exited on signal 11 (core dumped)
```
### 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.3.0 (x86_64/freebsd) 4cc67a
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, 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, select, kqueue.
id: 4cc67a
compiled on 18:51:34 Oct 25 2019 with cc 6.0
```
* **Operating System**:
FreeBSD 12.0
```
FreeBSD home.XXX 12.0-RELEASE-p10 FreeBSD 12.0-RELEASE-p10 GENERIC amd64
```
--
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/2121
kamctl's dbtextdb.py fails to build in a Python3-only environment. Update dbtextdb to Python3.
--
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/1747
```
CC (gcc) [M db_redis.so] redis_table.o
CC (gcc) [M db_redis.so] db_redis_mod.o
CC (gcc) [M db_redis.so] redis_connection.o
In file included from ../../lib/srdb1/../../core/ut.h:42,
from ../../lib/srdb1/db_key.h:31,
from ../../lib/srdb1/db.h:43,
from db_redis_mod.h:26,
from redis_table.c:25:
redis_table.c: In function 'db_redis_parse_keys':
../../lib/srdb1/../../core/dprint.h:303:8: warning: 'table_name.len' may be used uninitialized in this function [-Wmaybe-uninitialized]
303 | fprintf(stderr, "%2d(%d) %s: %.*s%s" fmt, \
| ^~~~~~~
redis_table.c:494:9: note: 'table_name.len' was declared here
494 | str table_name;
| ^~~~~~~~~~
In file included from ../../lib/srdb1/../../core/ut.h:42,
from ../../lib/srdb1/db_key.h:31,
from ../../lib/srdb1/db.h:43,
from db_redis_mod.h:26,
from redis_table.c:25:
../../lib/srdb1/../../core/dprint.h:303:8: warning: 'table_name.s' may be used uninitialized in this function [-Wmaybe-uninitialized]
303 | fprintf(stderr, "%2d(%d) %s: %.*s%s" fmt, \
| ^~~~~~~
redis_table.c:494:9: note: 'table_name.s' was declared here
494 | str table_name;
| ^~~~~~~~~~
redis_table.c:581:38: warning: 'table' may be used uninitialized in this function [-Wmaybe-uninitialized]
581 | table->types = type_target = type;
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
CC (gcc) [M db_redis.so] redis_dbase.o
make[3]: 'libsrdb2.so.1.0' is up to date.
make[3]: 'libsrdb1.so.1.0' is up to date.
```
--
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/2169
- Prevent multiple contacts for NOTIFY message in
Message body <registration> tag after
RE-REGISTRATION procedure.
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [x] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2246
-- Commit Summary --
* ims_registrar_scscf: fix multiple contacts in NOTIFY
-- File Changes --
M src/modules/ims_registrar_scscf/registrar_notify.c (86)
M src/modules/ims_registrar_scscf/registrar_notify.h (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2246.patchhttps://github.com/kamailio/kamailio/pull/2246.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/2246
<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please use this template only for bug reports.
If you have questions about using Kamailio or related to its configuration file, ask on sr-users mailing list:
* http://lists.kamailio.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.kamailio.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 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.
-->
Ubuntu Bionic 18.04.02 LTS ships with "OpenSSL 1.1.1 11 Sep 2018" (0x1010100f), whereas the `kamailio-tls-modules` package is compiled with "OpenSSL 1.1.0g 2 Nov 2017" (0x1010007f).
I installed Kamailio from the Kamailio repositories (not from the Ubuntu repositories).
This leads to Kamailio being unable to start as it complains about the OpenSSL versions being too different from each other.
Overriding the OpenSSl version check by enabling `tls_force_run` does not solve the issue, instead, it leads to Kamailio emitting multiple errors.
<!-- ### Troubleshooting -->
#### Reproduction
I installed Kamailio from the official Kamailio apt sources (nightly build, the same occurs for the latest stable version 5.2).
```
deb http://deb.kamailio.org/kamailiodev-nightly bionic main
deb-src http://deb.kamailio.org/kamailiodev-nightly bionic main
```
I enabled TLS and edited the configuration files accordingly.
<!--
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.
-->
```
(paste your debugging data here)
```
#### Log Messages
```
CRITICAL: tls [tls_init.c:677]: init_tls_h(): installed openssl library version is too different from the library the kamailio tls module was compiled with: installed "OpenSSL 1.1.1 11 Sep 2018" (0x1010100f), compiled "OpenSSL 1.1.0g 2 Nov 2017" (0x1010007f).#012 Please make sure a compatible version is used (tls_force_run in kamailio.cfg will override this check)
```
<!-- #### SIP Traffic -->
### Possible Solutions
Recompile and publish the `kamailio-tls-modules` package compiled with OpenSSL 1.1.1b.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.3.0-dev6 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, 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: unknown
compiled with gcc 7.3.0
```
* **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`)
-->
```
Linux hostname 4.15.0-55-generic #60-Ubuntu SMP Tue Jul 2 18:22:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Description: Ubuntu 18.04.2 LTS
Release: 18.04
```
--
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/2018
### Description
The commands available to extract dialog information `dlg.profile_list` and `dlg.list`
Are not fast enough to output a large amount of dialogs.
After doing some benchmark the time is spent in in `rpc->struct_add`, `rpc->add etc`, etc.
it appears to be slowing down linearly.
### Possible Solutions
I made a quick POC to verify what I can get if I output to file instead and I got blazing fast performance, this is good news since it means that iterating over the hash table etc. is super fast.
https://github.com/jchavanton/kamailio/commit/f28c5a6b6364d79ee35acb5be439e…
```
dialog: outputing large amount of dialogs to file
Test:
1) injecting 100K dialogs with voip_perf
2) confirmation that we have 100K+ dialogs
kamcmd dlg.profile_get_size outbound_call
100879
3) execute the quickly hacked modifications to output to /tmp/dialogs.txt
kamctl rpc dlg.profile_list outbound_call
3.1) verify how long it took
2020-03-31T22:28:18.398916476Z 12(31) : dialog [dialog.c:2174]: internal_rpc_profile_print_dlgs(): profile->lock
2020-03-31T22:28:18.554379411Z 12(31) : dialog [dialog.c:2190]: internal_rpc_profile_print_dlgs(): profile->lock release
// command took less then 20ms
3.2) verify the content of the output
wc /tmp/dialogs.txt
124355 117324 20547037 /tmp/dialogs.txt
Note about the content
// not everything is outputed in this quick hack but we can imagine that the impact will be very low.
call-id[uV.YzlhIZd1inE8SYDAlzmOLG12tYqVS]from[sip:voip_perf@147.75.65.247]to[sip:12060412757@52.42.112.21]h_entry[6207]h_id[44579]ref[2]contact[sip:voip_perf@147.75.65.247:5072;transport=udp]cseq[19528]
```
### Additional Information
I am thinking about adding commands to output to file in `json` and/or `csv`
--
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/2269
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [ ] Commit message has the format required by CONTRIBUTING guide
- [ ] Commits are split per component (core, individual modules, libs, utils, ...)
- [ ] Each component has a single commit (if not, squash them into one commit)
- [ ] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [X] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [X] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
192.0.0.0/29 is a reserved subnet for NATtin IPv4 across an IPv6 netwerk. For example Dual Stack Lite carrier grade NAT.
This is small change and updates the subnets used for NAT according to https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-speci…
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1488
-- Commit Summary --
* Support for
-- File Changes --
M src/modules/ipops/detailed_ip_type.c (1)
M src/modules/ipops/detailed_ip_type.h (2)
M src/modules/nat_traversal/nat_traversal.c (3)
M src/modules/nathelper/nathelper.c (1)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1488.patchhttps://github.com/kamailio/kamailio/pull/1488.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/1488
Hi all,
I've been recently testing 5.3.x/master siptrace module, in particular the
new trace mode "t" vs the legacy flag + sip_trace() mode and I've found
some issues with the handling of CANCEL. Specifically, I've tested the
following scenarios:
1) sip_trace_mode("t") on the initial INVITE only: received ACK for
negative replies not captured
2) sip_trace_mode("t") on the initial INVITE and on neg ACK: received ACK
captured twice
3) setflag and sip_trace() on the initial INVITE only: received CANCEL and
ACK not captured (outgoing yes)
4) setflag and sip_trace() on the initial INVITE and ACK: received CANCEL
not captured, received ACK captured twice
5) setflag and sip_trace() for each message (legacy): received CANCEL and
200 captured twice, received ACK captured twice
Digging into the module's code the "culprit" looks to be trace_is_off
function (
https://github.com/kamailio/kamailio/blob/2768f8ce1cf6da242674e7e40c8e76eb6…)
and the places where it is called.
E.g.: for the case 1), when a negative reply is
received, trace_tm_neg_ack_in is called, which calls inside trace_is_off (
https://github.com/kamailio/kamailio/blob/2768f8ce1cf6da242674e7e40c8e76eb6…),
which cannot be true unless the ACK has been marked for capture in the
script, in which case it will be capture twice (case 2). The same applies
to the CANCEL for case 3), in trace_onreq_out (callback
for TMCB_E2ECANCEL_IN) trace_is_off because the incoming message is not
flagged. Case 3) should theoretically behave like case 1) according to
commit
https://github.com/kamailio/kamailio/commit/40e09d8625184f19ff5666a2848cbb8…
.
I'm not really sure if (and how) modify the trace_is_off function or not
calling it in specific cases. E.g.: why calling it in trace_tm_neg_ack_in?
This callback is set when we explicity want to trace a transaction, so why
checking inside if tracing is on? Maybe I'm missing something, but I think
that probably the different behaviors of the modes should be better
specified/decided.
Best regards,
Federico