Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings emitted when calling functions from dialplan module #3851

Closed
whosgonna opened this issue May 15, 2024 · 4 comments
Closed

Warnings emitted when calling functions from dialplan module #3851

whosgonna opened this issue May 15, 2024 · 4 comments
Assignees

Comments

@whosgonna
Copy link
Contributor

Description

Calling functions from the dialplan module in 5.8 (dp_translate(), dp_match()) results in the following line being logged:

WARNING: <core> [core/mem/q_malloc.c:520]: qm_free(): WARNING: free(0) called from dialplan: dp_db.c: pcre2_free(206)

Is this a functional problem, or just a case of overly aggressive logging?

Troubleshooting

Reproduction

Reproducible with the following kamailio config:

#!KAMAILIO

loadmodule "pv"
loadmodule "db_sqlite"
loadmodule "xlog"
loadmodule "dialplan"

disable_tcp = true
force_rport = true

!!define DBFILE /etc/kamailio/kamailio.sqlite

modparamx("db_sqlite","db_set_readonly", "$def(DBFILE)")

modparamx("dialplan","db_url", "sqlite:///$def(DBFILE)")
modparam("dialplan", "attrs_pvar", "$avp(dp_attrs)")

request_route {
    if ( $rm == "ACK" ) {
        exit;
    }

    xinfo("$ci New request\n");

    dp_match("1", "$rU");
    exit;
}

The warning log is issued in 5.8 but not 5.7. Reproduced by sending a request with SIPp:

sipp -sn uac  -m 1 -s 15554445555 localhost

Possible Solutions

Not sure if this is just a case of logging being overly aggressive, or an issue with the module's memory management.

Additional Information

  • Kamailio Version - output of kamailio -v
version: kamailio 5.8.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, MEM_JOIN_FREE, 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_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: unknown
compiled with gcc 12.2.0

Tested using docker debian:12-slim using the official packages from http://deb.kamailio.org/kamailio58

  • Operating System:

Docker debian:12-slim, but also observed in Alpine Linux/

@linuxmaniac linuxmaniac self-assigned this May 15, 2024
@whosgonna
Copy link
Contributor Author

Is there any indication if this is a functional problem, or just a case of logging that should be reduced - I'm trying to gauge if I should hold off before upgrading.

@henningw
Copy link
Contributor

It is a warning, which should not be reduced or silenced. The memory manager emits this warning because its not used correctly, e.g. in the example above a free(0) was called. It should be investigated in the module. Its only warning level, so it might be not a serious issue.

@joelsdc
Copy link

joelsdc commented May 20, 2024

I was able to "get around" that warning by changing the memory manager.

Not sure if this is the correct solution/workaround, but having the constant warnings in the logs seems wrong.

I added -x fm -X fm to the kamailio run command.

Any downside to this change?

@henningw
Copy link
Contributor

I was able to "get around" that warning by changing the memory manager.

Not sure if this is the correct solution/workaround, but having the constant warnings in the logs seems wrong.

I added -x fm -X fm to the kamailio run command.

Any downside to this change?

Well, the issue is still there, the other memory manager just did not log a warning message for it. I personally would not recommend to switch to a much less used memory manager which might cause unknown issues for your workload just for getting rid of a few warnings. As said already, the issue needs to be analyzed in the dialplan module and fixed there. If you are annoyed from the warnings, just increase the log level to ERROR level for now.

linuxmaniac added a commit that referenced this issue May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants