sergey-safarov created an issue (kamailio/kamailio#4257)
### Description
We found a memory leak in the AVP cleanup
### Troubleshooting
#### Reproduction
To reproduce, you need to start Kaamilio 5.8 branch with the config
```
listen=127.0.0.1:5060
tcp_send_timeout=3
loadmodule "xlog.so"
loadmodule "kex.so"
loadmodule "pv.so"
loadmodule "ctl.so"
loadmodule "jsonrpcs.so"
loadmodule "tm.so"
loadmodule "siptrace.so"
modparam("siptrace", "trace_to_database", 0)
modparam("siptrace", "trace_on", 1)
modparam("siptrace", "trace_mode", 1)
modparam("siptrace", "trace_init_mode", 1)
loadmodule "permissions.so"
modparam("permissions", "address_file", "address.list")
modparam("permissions", "peer_tag_avp", "$avp(s:tag)")
modparam("permissions", "peer_tag_mode", 0)
modparam("permissions", "load_backends", 1)
modparam("permissions", "reload_delta", 1)
loadmodule "dispatcher.so"
modparam("dispatcher", "list_file", "/tmp/dispatcher.list")
modparam("dispatcher", "ds_ping_from", "sip:proxy@aggregator.nga911.com")
modparam("dispatcher", "ds_ping_interval", 3)
modparam("dispatcher", "ds_probing_mode", 1)
route{
drop;
}
event_route[siptrace:msg] {
if (allow_address("1", "$siptrace(src_hostip)", "0")) {
xerr("SIP message from $siptrace(src_hostip)\n");
}
}
```
Also need to create `address.list` with content
```
# address file - records to match with allow_address(...) and variants
# * file format details
# - comments start with # and go to end of line
# - each line corresponds to a record with following attributes:
#
# (groupid,int) (address,str) (netmask,int,o), (port,int,o) (tag,str,o)
#
# * description of the tokens used to describe line format
# - int: expected integer value
# - str: expected string value
# - o: optional field
1 127.0.0.0 16 0 tag
```
and `/tmp/dispatcher.list` with content
```
1 sip:sip.telnyx.com:5060;transport=tcp 8
```
When kamailio started required to execute a command
```
kamcmd mod.stats core shm| grep avp
```
This will produce output like
```
create_avp(178): 1360
init_avps(92): 16
init_avps(91): 16
```
Where `create_avp` is constantly increasing
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4257
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4257(a)github.com>
<!-- 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
- [x ] Related to issue #4257
#### Description
When the dispatcher module sends ping requests then these requests are executed in a dedicated process, which handles timers and called `slow timer`. If during this ping request AVP variables are allocated, then these vars are allocated within `slow timer` process and this memory is never released and continiously accumulates in/by this process.
This change makes AVP vars being reset for every iteration of the `dispatcher` timer procedure (`ds_check_timer` function).
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/4258
-- Commit Summary --
* dispatcher: fixed memory leak when avp is indirectly used
-- File Changes --
M src/modules/dispatcher/dispatch.c (1)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/4258.patchhttps://github.com/kamailio/kamailio/pull/4258.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4258
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/4258(a)github.com>
ovedeneev created an issue (kamailio/kamailio#4187)
### Description
[tcp_send_timeout](https://www.kamailio.org/wikidocs/cookbooks/5.8.x/core/#t… option does not apply for outbound connections.
#### Reproduction
1. Establish TCP OPTIONS between Kamailio and target node.
2. On target node block incoming traffic from Kamailio node using iptables.
3. Notice on Kamailio node that TCP retransmission packets don't follow tcp_send_timeout settings, instead they fall back to kernel's net.ipv4.tcp_retries2 settings.
### Additional Information
* **Kamailio Version**
```
# kamailio -V
version: kamailio 5.8.2 (aarch64/linux) 446039
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT-NOSMP, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_SEND_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: 446039
compiled on 14:32:09 Nov 14 2024 with gcc 8.5.0
```
* **Operating System**:
```
Linux xxx 4.18.0-553.6.1.el8.aarch64 #1 SMP Thu May 30 04:10:32 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4187
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4187(a)github.com>
introduce proper code indentation in examples
<!-- 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
- [ ] 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
- [ ] 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/4278
-- Commit Summary --
* rtpengine: fix formatting of subscribe/unsubscribe examples
-- File Changes --
M src/modules/rtpengine/doc/rtpengine_admin.xml (153)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/4278.patchhttps://github.com/kamailio/kamailio/pull/4278.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4278
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/4278(a)github.com>
Module: kamailio
Branch: master
Commit: a0a92fa6e829bdc2ef8f1e537cf9209ada32ef0b
URL: https://github.com/kamailio/kamailio/commit/a0a92fa6e829bdc2ef8f1e537cf9209…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2025-06-10T15:16:10+02:00
modules: readme files regenerated - pdb ... [skip ci]
---
Modified: src/modules/pdb/README
---
Diff: https://github.com/kamailio/kamailio/commit/a0a92fa6e829bdc2ef8f1e537cf9209…
Patch: https://github.com/kamailio/kamailio/commit/a0a92fa6e829bdc2ef8f1e537cf9209…
---
diff --git a/src/modules/pdb/README b/src/modules/pdb/README
index 0c2ec72e122..d5c1c1fa16a 100644
--- a/src/modules/pdb/README
+++ b/src/modules/pdb/README
@@ -38,7 +38,7 @@ Muhammad Shahzad Shafi
4. Functions
- 4.1. pdb_query (string query, string dstavp)
+ 4.1. pdb_query (string query, string dstpv)
5. RPC Commands
@@ -76,7 +76,7 @@ Chapter 1. Admin Guide
4. Functions
- 4.1. pdb_query (string query, string dstavp)
+ 4.1. pdb_query (string query, string dstpv)
5. RPC Commands
@@ -163,24 +163,24 @@ modparam("pdb", "ll_info", 3)
4. Functions
- 4.1. pdb_query (string query, string dstavp)
+ 4.1. pdb_query (string query, string dstpv)
-4.1. pdb_query (string query, string dstavp)
+4.1. pdb_query (string query, string dstpv)
Sends the query string to all configured servers and stores the answer
- in dstavp. If it takes more than the configured timeout, false is
- returned. Pseudo-variables or AVPs can be used for the query string.
- The answer must consist of the null terminated query string followed by
- a two byte integer value in network byte order. The integer value will
- be stored in the given AVP.
+ in dstvp. If it takes more than the configured timeout, false is
+ returned. In addition to a string, any pseudo-variable can be used as
+ query. The answer must consist of the null terminated query string
+ followed by a two byte integer value in network byte order. The integer
+ value will be stored in the given pseudo-variable dstvp.
Example 1.4. pdb_query usage
...
# query external service for routing information
-if (!pdb_query("$rU", "$avp(i:82)"))
- $avp(i:82) = 0; # default routing
+if (!pdb_query("$rU", "$avp(routing)"))
+ $avp(routing) = 0; # default routing
}
-cr_route("$avp(i:82)", "$rd", "$rU", "$rU", "call_id");
+cr_route("$avp(routing)", "$rd", "$rU", "$rU", "call_id");
...
5. RPC Commands
Module: kamailio
Branch: master
Commit: ae133c0765c01827b172f2c3e38e2d33d5cdcd6b
URL: https://github.com/kamailio/kamailio/commit/ae133c0765c01827b172f2c3e38e2d3…
Author: Henning Westerholt <hw(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2025-06-10T13:14:55Z
pdb: remove AVP references completely, add some doxygen notes for helper function
---
Modified: src/modules/pdb/pdb.c
---
Diff: https://github.com/kamailio/kamailio/commit/ae133c0765c01827b172f2c3e38e2d3…
Patch: https://github.com/kamailio/kamailio/commit/ae133c0765c01827b172f2c3e38e2d3…
---
diff --git a/src/modules/pdb/pdb.c b/src/modules/pdb/pdb.c
index 1add3e1a075..eb6731d4ce7 100644
--- a/src/modules/pdb/pdb.c
+++ b/src/modules/pdb/pdb.c
@@ -216,7 +216,7 @@ int ki_pdb_query(sip_msg_t *_msg, str *number, str *dstvar)
*
* @param _msg the current SIP message
* @param _number the phone number to query
- * @param _dstavp the name of the AVP where to store the result
+ * @param _dstvar the name of the pv where to store the result
*
* @return 1 on success, -1 on failure
*/
@@ -234,7 +234,13 @@ int pdb_query(sip_msg_t *_msg, str *_number, str *_dstvar)
/*!
- * \return 1 if query for the number succeeded and the avp with the corresponding carrier id was set,
+ * Helper function for queries
+ *
+ * @param _msg the current SIP message
+ * @param number the phone number to query
+ * @param dstvar the name of the pv where to store the result
+ *
+ * @return 1 if query for the number succeeded and the pv with the corresponding carrier id was set,
* -1 otherwise
*/
int ki_pdb_query_helper(sip_msg_t *_msg, str *number, pv_spec_t *dvar)
@@ -495,7 +501,7 @@ int pdb_query_fixup(void **arg, int arg_no)
return -1;
}
} else if(arg_no == 2) {
- /* destination avp name */
+ /* destination pv name */
if(fixup_pvar_null(arg, 1) != 0) {
LM_ERR("cannot fixup parameter %d\n", arg_no);
return -1;
Module: kamailio
Branch: master
Commit: 7be5b4c96561430c6d5ec528dcceb5ffba56f7c6
URL: https://github.com/kamailio/kamailio/commit/7be5b4c96561430c6d5ec528dcceb5f…
Author: Henning Westerholt <hw(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2025-06-10T13:14:34Z
pdb: remove AVP references completely in docs, improve example
---
Modified: src/modules/pdb/doc/pdb_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/7be5b4c96561430c6d5ec528dcceb5f…
Patch: https://github.com/kamailio/kamailio/commit/7be5b4c96561430c6d5ec528dcceb5f…
---
diff --git a/src/modules/pdb/doc/pdb_admin.xml b/src/modules/pdb/doc/pdb_admin.xml
index f638a29ed32..797fd510d82 100644
--- a/src/modules/pdb/doc/pdb_admin.xml
+++ b/src/modules/pdb/doc/pdb_admin.xml
@@ -124,27 +124,27 @@ modparam("pdb", "ll_info", 3)
<title>Functions</title>
<section>
<title>
- <function moreinfo="none">pdb_query (string query, string dstavp)</function>
+ <function moreinfo="none">pdb_query (string query, string dstpv)</function>
</title>
<para>
Sends the query string to all configured servers and stores the answer in
- dstavp. If it takes more than the configured timeout, false is returned.
+ dstvp. If it takes more than the configured timeout, false is returned.
In addition to a string, any pseudo-variable can be used as query.
The answer must consist of the null terminated query string followed by
a two byte integer value in network byte order. The integer value will
- be stored in the given pseudo-variable dstavp.
+ be stored in the given pseudo-variable dstvp.
</para>
<example>
<title><function>pdb_query</function> usage</title>
<programlisting format="linespecific">
...
# query external service for routing information
-if (!pdb_query("$rU", "$avp(i:82)"))
- $avp(i:82) = 0; # default routing
+if (!pdb_query("$rU", "$avp(routing)"))
+ $avp(routing) = 0; # default routing
}
-cr_route("$avp(i:82)", "$rd", "$rU", "$rU", "call_id");
+cr_route("$avp(routing)", "$rd", "$rU", "$rU", "call_id");
...
</programlisting>
</example>