On Jun 10, 2025, at 4:00 PM, JR Richardson via sr-users sr-users@lists.kamailio.org wrote:
Hey Folks,
Running kamailio 5.8.4, haven't needed or used DNS functions previously but recently completed clearip integration, which requires sip request to use URL instead of IP and resolve where to send request. Within hours of adding URL lookups I started getting dns_hash unlinked errors. I correlated the log errors to when the URL changed IP. I assume the caching is working because kamailio sends to the same IP for a few minutes, then switches IP, sends to new IP for a few minutes, then switches IP again and this activity continues.
Here are some log errors:
switch IP Jun 10 14:14:17 siprouter1-pve186 /usr/local/sbin/kamailio[8111]: WARNING: <core> [core/dns_cache.c:170]: dns_hash_put(): unlinked item 0x7fa0f9b9fcc0 Jun 10 14:14:19 siprouter1-pve186 /usr/local/sbin/kamailio[8122]: WARNING: <core> [core/dns_cache.c:185]: dns_hash_put_shm_unsafe(): unlinked item 0x7fa0f9b9fcc0
switch IP Jun 10 14:15:00 siprouter1-pve186 /usr/local/sbin/kamailio[8111]: WARNING: <core> [core/dns_cache.c:170]: dns_hash_put(): unlinked item 0x7fa0f9b9ee00 Jun 10 14:15:03 siprouter1-pve186 /usr/local/sbin/kamailio[8122]: WARNING: <core> [core/dns_cache.c:185]: dns_hash_put_shm_unsafe(): unlinked item 0x7fa0f9b9ee00
switch IP Jun 10 14:15:33 siprouter1-pve186 /usr/local/sbin/kamailio[8110]: WARNING: <core> [core/dns_cache.c:170]: dns_hash_put(): unlinked item 0x7fa0f9b8e640 Jun 10 14:15:33 siprouter1-pve186 /usr/local/sbin/kamailio[8122]: WARNING: <core> [core/dns_cache.c:185]: dns_hash_put_shm_unsafe(): unlinked item 0x7fa0f9b8e640
switch IP Jun 10 14:20:37 siprouter1-pve186 /usr/local/sbin/kamailio[8109]: WARNING: <core> [core/dns_cache.c:170]: dns_hash_put(): unlinked item 0x7fa0f9b3eb60
switch IP Jun 10 14:21:12 siprouter1-pve186 /usr/local/sbin/kamailio[8117]: WARNING: <core> [core/dns_cache.c:170]: dns_hash_put(): unlinked item 0x7fa0f9b830f0 Jun 10 14:21:23 siprouter1-pve186 /usr/local/sbin/kamailio[8122]: WARNING: <core> [core/dns_cache.c:185]: dns_hash_put_shm_unsafe(): unlinked item 0x7fa0f9b830f0
Here are my DNS config parameters, nothing I've changed made any difference. And as far as I can tell I'm not dropping any clearip queries. dns=no rev_dns=no use_dns_failover=on dns_try_ipv6=no
I did find a patch update for this error back from 2023 and the patch is in my /src/core/dns_cache.c as expected but still getting errors.
Any guidance in clearing this error?
Thanks. JR
Not an answer to your question, but to use failover, use_dns_cache (I believe) needs to be on.
https://github.com/kamailio/kamailio/blob/master/doc/tutorials/dns.txt
Fred Posner
Hi Fred,
I read through the DNS docs and believe I have a good understanding, dns_cache is on my default so you don't have to explicitly define it in the config. After further diagnosis I found the dns errors "dns_hash_put(): unlinked item" happen at the same time the DNS query goes out (around 4min30sec to 5min intervals) but the errors in the log don't happen on every DNS query, they only appear when the URL IP changes.
This is what I'm seeing, matching timestamps to DNS queries and SIP Invites to clearip. DNS query clearip.com IP#1 no error DNS query clearip.com IP#1 no error DNS query clearip.com IP#2 error DNS query clearip.com IP#1 error DNS query clearip.com IP#1 no error DNS query clearip.com IP#2 error DNS query clearip.com IP#2 no error DNS query clearip.com IP#2 no error DNS query clearip.com IP#1 error
Because I'm not seeing any performance or SIP processing issues, I now believe the log entry is a false positive and can be disregarded, I mean it is a warning, but there is no ill effect as far as I can tell, just a lot of log messages, maybe this message should be downgraded to informational? WARNING: <core> [core/dns_cache.c:170]: dns_hash_put(): unlinked item ...... WARNING: <core> [core/dns_cache.c:185]: dns_hash_put_shm_unsafe(): unlinked item ...... *****(why is this one "shm_unsafe")
Thanks.
JR