hello ,
I 'm trying to change value "xhttp_prom_timeout" to specific value , for instance 1 minute , to do i set command : modparam("xhttp_prom", "xhttp_prom_timeout", 1) , but it seems metrics is not deleted after 1 minute of not using this metric , only metric is deleted after 10 hours , even i set xhttp_prom_timeoutto 1
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3439
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3439(a)github.com>
### Description
_**Sipwise** hat on_
We noticed that pkg memory was getting exhausted and we found out that pv_cache_add() was the origin of the allocations.
We are using ``$xavp(user_<UUID>)`` variables that, for sure, are kind of dynamic.
There is a pv_cache_drop() that tries to remove ``$sht()`` occurrences when the cache is about to be filled but in our case that's not helping.
#### Log Messages
```
WARNING: ROUTE_SET_CALLEE_DIALOG_TOTAL <core> [core/pvapi.c:340]: pv_cache_add(): pv cache limit is going to be exceeded - pkg memory may get filled with pv declarations
WARNING: dialog:failed <core> [core/pvapi.c:340]: pv_cache_add(): pv cache limit is going to be exceeded - pkg memory may get filled with pv declarations
```
### Possible Solutions
Possible solutions that came on the top of my head:
- add a datetime member to struct _pv_cache so we can keep the last time it was accessed and search for the oldest and remove them in pv_cache_drop()
- add pv module parameter to define a magic prefix, for instance '__' that will mark those vars as "temporal" should remove it from cache when needed.
- add pv module parameter to control what types of variables will be added to cache
Any thoughts about this?
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3440
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3440(a)github.com>
### Description
We've been experiencing random Kamailio crashes related to invalid memory access attempts at `0xffff` in `w_save` call, `ims_registrar_scscf_mod.c`:
```
Core was generated by `kamailio -w /home -DD -E -e -f /etc/kamailio/kamailio_scscf.cfg'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f5be796c452 in w_save (_m=0x7f5beafa5188, _route=0x7f5beaeab988 " \b\361\352[\177", _d=0x7f5be3bf8200 "", mode=0x7f5beafa5188 "4", _cflags=0xffff <error: Cannot access memory at address 0xffff>)
at ims_registrar_scscf_mod.c:628
```
We are running the latest Kamailio 5.6.4 using the official Docker image.
### Analysis
We were able to analyze corresponding core dump using `gdb` and determine the cause of those random crashes. It turns out that it is related to calling the `save` function of IMS Registrar SCSCF module with 2 arguments.
Example configuration:
```
save("REG_SAR_REPLY", "location");
```
According to documentation, this call is valid, as `mode` and `flags` parameters are optional:
https://kamailio.org/docs/modules/5.6.x/modules/ims_registrar_scscf.html#id…
The `save` function is exported in `ims_registrar_scscf_mod.c` as follows:
```
/*! \brief
* Exported functions
*/
static cmd_export_t cmds[] = {
{"save", (cmd_function) w_save, 2, assign_save_fixup3_async, 0, REQUEST_ROUTE | ONREPLY_ROUTE},
{"save", (cmd_function) w_save, 3, assign_save_fixup3_async, 0, REQUEST_ROUTE | ONREPLY_ROUTE},
{"save", (cmd_function) w_save, 4, save_fixup3, free_uint_fixup, REQUEST_ROUTE | ONREPLY_ROUTE},
...
}
```
And implemented as:
```
/*! \brief
* Wrapper to save(location)
*/
static int w_save(struct sip_msg* _m, char* _route, char* _d, char* mode, char* _cflags) {
if(_cflags){
return save(_m, _d, _route, ((int)(*_cflags)));
}
return save(_m, _d, _route, 0);
}
```
Using the 2-argument `save` variant in configuration effectively causes the `w_save` to be called from `src/core/action.c :: do_action` via a 3-argument function-pointer cast:
```
case MODULE2_T:
MODF_CALL(cmd_function, h, msg, a->val,
(char*)a->val[2].u.data,
(char*)a->val[3].u.data
);
break;
```
Unfortunately, this cast is inherently unsafe - it leaves the `mode` and `_cflags` undetermined. They are probably effectively bound to some memory area beyond the parameter values of the stack frame corresponding to the function call.
Our guess is that incidentally `_cflags == 0x0000` for most of those calls, due to how the stack is structured. But sometimes `_cflags == 0xFFFF` which satisfies the condition in `w_save`, causes `(int)(*_cflags)` dereference attempt and leads to the segmentation fault we've encountered.
### Workaround
Based on source code analysis, we have determined that always using `save` with a full set of arguments (including optional ones) will result in `w_save` being called via a 5-argument function pointer, which matches its signature and avoids the issue.
Example configuration with workaround applied:
```
save("REG_SAR_REPLY", "location", "0", "0");
```
After introducing this workaround on target environment we are no longer experiencing the problem.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3412
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3412(a)github.com>
We had a Kamailio 5.5.4 server crash. There were lots of the following errors repeated over and over in the Kamailio log:
Mar 10 14:59:14 px1 /usr/sbin/kamailio[1375]: WARNING: <core> [core/tcp_read.c:1840]: handle_io(): F_TCPCONN connection marked as bad: 0x7f48e97ecdc8 id 0 fd -1 refcnt 0 ([]:0 -> []:0)
Mar 10 14:59:14 px1 /usr/sbin/kamailio[1375]: CRITICAL: <core> [core/io_wait.h:596]: io_watch_del(): invalid fd -1, not in [0, 2)
And in the syslog it said:
Mar 10 14:59:14 px1 kernel: [731786.728781] kamailio[1363]: segfault at 10 ip 00007f48e6dde42d sp 00007ffc2d23ef00 error 4 in tls.so[7f48e6d9c000+47000]
Mar 10 14:59:14 px1 kernel: [731786.728814] Code: 98 01 5c 24 28 41 29 dd 49 01 84 24 40 01 00 00 c7 44 24 6c 00 00 00 00 85 c9 0f 85 be 08 00 00 49 8b 94 24 90 01 00 00 31
f6 <48> 8b 7a 10 31 d2 e8 38 10 fc ff 85 c0 0f 8e 90 0d 00 00 45 31 db
Is anyone able to advise whether this is a known issue, and if it's fixed in a more recent version? The only related bug report I found was issue #748 which was closed without resolution. Our Kamailio is installed from the Ubuntu 22.04 repository.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3392
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3392(a)github.com>
On Fedora Core when installed Kamailio and then installed additional packages then receive error
```
[root@caloes-1 ~]# journalctl -flu ostree-boot-complete.service -o cat
Starting ostree-boot-complete.service - OSTree Complete Boot...
error: ostree-finalize-staged.service failed on previous boot: During /etc merge: Modified config file newly defaults to directory 'kamailio', cannot merge
ostree-boot-complete.service: Main process exited, code=exited, status=1/FAILURE
ostree-boot-complete.service: Failed with result 'exit-code'.
Failed to start ostree-boot-complete.service - OSTree Complete Boot.
ostree-boot-complete.service - OSTree Complete Boot was skipped because all trigger condition checks failed.
ostree-boot-complete.service - OSTree Complete Boot was skipped because all trigger condition checks failed.
ostree-boot-complete.service - OSTree Complete Boot was skipped because all trigger condition checks failed.
```
Suggestion place default Kamailio config into dedicated package "kamailio-config-default".
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3252
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3252(a)github.com>
### Description
I established a call between two extensions using TLS, and the presence state was replicated between two Kamailio servers using presence_dmq (no database backing). This all worked correctly except when it comes to sending a PUBLISH with a state terminated in the body, the presence_dmq sent the serialized data correctly, but the Kamailio server sends the wrong state and the caller is marked as busy on all subscribed phones until Kamailio is restarted. This occurs on version 5.6.1. In order generate this data, we use a separate script which responds to Asterisk events and sends the right PUBLISH at the right time to Kamailio, eg. if it sees a Hangup event, it sends a PUBLISH with the state in the body set to 'terminated' and the Expires: header set to 0. This appears to prompt Kamailio to send a NOTIFY with a state of early or confirmed to all subscribers.
### Troubleshooting
#### Reproduction
Install two Kamailio servers running Kamailio 5.6.1. I am using this installation command:
`sudo apt install kamailio=5.6.1+bpo9 kamailio-dbg=5.6.1+bpo9 kamailio-lua-modules=5.6.1+bpo9 kamailio-memcached-modules=5.6.1+bpo9 kamailio-mysql-modules=5.6.1+bpo9 kamailio-presence-modules=5.6.1+bpo9 kamailio-redis-modules=5.6.1+bpo9 kamailio-tls-modules=5.6.1+bpo9 kamailio-utils-modules=5.6.1+bpo9`
Some configuration detail for /etc/kamailio/kamailio.cfg:
listen=tls:172.22.0.155:5061
# This ensures we have a UDP socket for sending HEP datagrams (we also send the plaintext UDP PUBLISH here)
listen=udp:172.22.0.155:9060
port=5061
enable_tls=yes
tcp_connection_lifetime=3605
#modules (this is not an exhaustive list)
loadmodule "dmq.so"
loadmodule "dialog.so"
loadmodule "presence.so"
loadmodule "presence_xml.so"
loadmodule "presence_dialoginfo.so"
loadmodule "pua.so"
loadmodule "pua_dialoginfo.so"
loadmodule "tls.so"
modparam("dmq", "server_address", "sip:172.22.0.155:9060")
modparam("dmq", "notification_address", "sip:172.22.1.124:9060")
modparam("dialog", "db_url", DBURL)
modparam("dialog", "enable_stats", 1)
modparam("dialog", "db_mode", 0) # 0 - NO_DB - the memory content is not flushed into DB
modparam("dialog", "dlg_flag", 9)
modparam("dialog", "enable_dmq", 1)
modparam("pua", "db_url", DBURL)
modparam("pua", "db_mode", 0) # high speed memory based storage
modparam("pua", "outbound_proxy", "sips:172.22.0.155:5061;transport=tls")
modparam("pua_dialoginfo", "include_localremote", 0)
modparam("presence", "db_url", DBURL)
modparam("presence", "server_address", "sips:this.host.example.org:5061;transport=tls")
modparam("presence", "db_table_lock_type", 0)
modparam("presence", "subs_db_mode", 0) # 0 - This disables database completely.
modparam("presence", "enable_dmq", 1)
modparam("presence", "publ_cache", 2)
modparam("presence", "subs_remove_match", 1)
modparam("presence", "timeout_rm_subs", 0)
modparam("presence_dialoginfo", "force_dummy_dialog", 1)
modparam("presence_dialoginfo", "force_single_dialog", 1)
modparam("presence_xml", "force_active", 1)
modparam("presence_xml", "force_presence_single_body", 1)
#### Log Messages
These log aren't directly linked but Kamailio reports a 200 OK in response to the PUBLISH, but the NOTIFY to the handset is _not_ terminated. Difficult to capture this because of TLS.
```
Aug 26 13:32:26 this.host.example.org /usr/sbin/kamailio[4187]: DEBUG: presence [presence_dmq.c:467]: pres_dmq_replicate_presentity(): sending serialized data {"action":1,"presentity":{"domain":"sip.prod.example.org","user":"XXXX469","etag":"a.1661495738.4187.2612.0","expires":3600,"recv":1661520746,"event":"dialog"},"t_new":1,"cur_etag":"","ruid":"pres-630869ce-105b-43a","body":"<?xml version=\"1.0\"?>\n<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"0\" state=\"full\" entity=\"sip:XXXX469@sip.prod.example.org\">\n<dialog id=\"c95340dd-5266-450a-8c53-a5cd75c4bb67\" call-id=\"c95340dd-5266-450a-8c53-a5cd75c4bb67\" direction=\"recipient\">\n<state>confirmed</state>\n</dialog>\n</dialog-info>\n"}
Aug 26 13:33:00 this.host.example.org /usr/sbin/kamailio[4187]: DEBUG: presence [presence_dmq.c:467]: pres_dmq_replicate_presentity(): sending serialized data {"action":1,"presentity":{"domain":"sip.prod.example.org","user":"XXXX469","etag":"a.1661495738.4187.2622.0","expires":0,"recv":1661520780,"event":"dialog"},"t_new":1,"cur_etag":"","ruid":"pres-630869ce-105b-e3a","body":"<?xml version=\"1.0\"?>\n<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"0\" state=\"full\" entity=\"sip:XXXX469@sip.prod.example.org\">\n<dialog id=\"c95340dd-5266-450a-8c53-a5cd75c4bb67\" call-id=\"c95340dd-5266-450a-8c53-a5cd75c4bb67\" direction=\"recipient\">\n<state>terminated</state>\n</dialog>\n</dialog-info>\n"}
```
This is a similar example:
```
Sep 1 12:37:14 this.host.example.org /usr/sbin/kamailio[5176]: INFO: presence [notify.c:1738]: send_notify_request(): NOTIFY sip:XXXX475@sip.prod.example.org via ÿÿÿÿÿÿÿÿ on behalf of sip:XXXX472@sip.prod.example.org for event dialog : 2_2191795053(a)172.31.29.18
Sep 1 12:37:14 this.host.example.org /usr/sbin/kamailio[5176]: DEBUG: presence [presence_dmq.c:400]: pres_dmq_replicate_presentity(): replicating presentity record - old etag a.1662035772.5176.17.0, new etag , ruid pres-6310a741-1438-11
Sep 1 12:37:14 this.host.example.org /usr/sbin/kamailio[5176]: DEBUG: presence [presence_dmq.c:467]: pres_dmq_replicate_presentity(): sending serialized data {"action":1,"presentity":{"domain":"sip.prod.example.org","user":"XXXX472","etag":"a.1662035772.5176.17.0","expires":0,"recv":1662035834,"event":"dialog"},"t_new":1,"cur_etag":"","ruid":"pres-6310a741-1438-11","body":"<?xml version=\"1.0\"?>\n<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"0\" state=\"full\" entity=\"sip:XXXX472@sip.prod.example.org\">\n<dialog id=\"76024a0e-2d35-47d8-afd1-a1363acbf859\" call-id=\"76024a0e-2d35-47d8-afd1-a1363acbf859\" direction=\"recipient\">\n<state>terminated</state>\n</dialog>\n</dialog-info>\n"}
Sep 1 12:37:14 this.host.example.org /usr/sbin/kamailio[5176]: DEBUG: presence [presence_dmq.c:149]: pres_dmq_send(): sending dmq broadcast...
```
#### SIP Traffic
```
PUBLISH sip:XXXX469@sip.prod.example.org SIP/2.0
Via: SIP/2.0/UDP this.host.example.org;branch=656ebca4-5e71-4082-984a-7efa54bdd2cc
To: sip:XXXX469@sip.prod.example.org
From: sip:XXXX469@sip.prod.example.org;tag=a06f8d92-609b-4210-a1f0-f7042b871f07
CSeq: 12 PUBLISH
Call-ID: d67c8bb5-f507-4ada-8f98-d7caa6d86721(a)this.host.example.org
Content-Length: 323
User-Agent: Astertisk-Event-Bridge
Max-Forwards: 70
Event: dialog
Expires: 0
Content-Type: application/dialog-info+xml
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="0" state="full" entity="sip:XXXX469@sip.prod.example.org">
<dialog id="9fa5bf3c-63f3-4d3f-82c5-cdff374c4e13" call-id="9fa5bf3c-63f3-4d3f-82c5-cdff374c4e13" direction="recipient">
<state>terminated</state>
</dialog>
</dialog-info>
```
### Possible Solutions
Downgrading to Kamailio version 5.5.4 resolves this problem.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
$ kamailio -v
version: kamailio 5.6.1 (x86_64/linux)
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, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, 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_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 6.3.0
$ dpkg -l | egrep '^ii' | grep kamailio | awk '{ print $2, $3 }'
kamailio 5.6.1+bpo9
kamailio-dbg:amd64 5.6.1+bpo9
kamailio-lua-modules:amd64 5.6.1+bpo9
kamailio-memcached-modules:amd64 5.6.1+bpo9
kamailio-mysql-modules:amd64 5.6.1+bpo9
kamailio-presence-modules:amd64 5.6.1+bpo9
kamailio-redis-modules:amd64 5.6.1+bpo9
kamailio-tls-modules:amd64 5.6.1+bpo9
kamailio-utils-modules:amd64 5.6.1+bpo9
```
* **Operating System**:
```
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.2 (stretch)
Release: 9.2
Codename: stretch
$ uname -a
Linux this.host.example.org 4.9.0-16-amd64 #1 SMP Debian 4.9.272-2 (2021-07-19) x86_64 GNU/Linux
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3229
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3229(a)github.com>
### Description
According to [RFC3261](https://datatracker.ietf.org/doc/html/rfc3261#section-20.14)
> The Content-Length header field indicates the size of the message-
> body, in decimal number of octets, sent to the recipient.
> Applications SHOULD use this field to indicate the size of the
> message-body to be transferred, regardless of the media type of the
> entity. If a stream-based protocol (such as TCP) is used as
> transport, the header field MUST be used.
When UDP protocol is used then this header is optional.
When Kamailio receives an OPTIONS request like in the example, then it floods Kamailio logs with messages like
```
sanity [sanity.c:612]: check_cl(): content length header missing in request
```
OPTIONS message example
```
OPTIONS sip:sbc-0.example.com:5060 SIP/2.0
Via: SIP/2.0/UDP 64.58.61.151:5060;branch=z9hG4bKl7oo3f30a0som61aeu00
Call-ID: 49bc1fcac14b779958dad4b9c43954b400149n2(a)64.58.61.151
To: sip:ping@sbc-0.example.com
From: <sip:ping@64.58.61.151>;tag=8fbe5af9178677655bc3a5388c2a8b8c00149n2
Max-Forwards: 70
CSeq: 299694 OPTIONS
Route: <sip:3.236.25.4:5060;lr>
```
### Expected behavior
Do not generate warnings about SIP messages that are allowed according to RFC.
#### Actual observed behavior
Generated warning when "Content-Length" header missing and used UDP protocol.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3210
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3210(a)github.com>