From 46cfac082555b02f44c3d6c4f8a2925c07d99b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 10 Feb 2026 06:16:31 +0100 Subject: [PATCH] Remove purged adb names and entries from SIEVE list immediately Both `expire_name()` and `expire_entry()` use the isc_async mechanism to remove names and entries from the SIEVE-LRU lists on the matching isc_loop. Under heavy load when the cleaning mechanism didn't have the chance to kick in yet, this delay could lead to double-counting the purged names and entries when purging the SIEVE-LRU lists during an overmem condition. This would result in insufficient memory being cleaned up, causing the ADB to never recover from the overmem condition and leading to an OOM crash of `named`. This patch resolves the issue by bypassing the async queue and executing the removal synchronously if the target loop matches the current isc_loop(). --- lib/dns/adb.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/dns/adb.c b/lib/dns/adb.c index 2e61c75534..217356fd27 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -696,7 +696,12 @@ expire_name(dns_adbname_t *adbname, dns_adbstatus_t astat) { /* Remove the adbname from the hashtable... */ if (cds_lfht_del(adb->names_ht, &adbname->ht_node) == 0) { - isc_async_run(adbname->loop, expire_name_async, adbname); + if (adbname->loop == isc_loop()) { + expire_name_async(adbname); + } else { + isc_async_run(adbname->loop, expire_name_async, + adbname); + } } } @@ -1467,7 +1472,12 @@ expire_entry(dns_adbentry_t *adbentry) { dns_adb_t *adb = adbentry->adb; if (cds_lfht_del(adb->entries_ht, &adbentry->ht_node) == 0) { - isc_async_run(adbentry->loop, expire_entry_async, adbentry); + if (adbentry->loop == isc_loop()) { + expire_entry_async(adbentry); + } else { + isc_async_run(adbentry->loop, expire_entry_async, + adbentry); + } } }