From: Ondřej Surý Date: Tue, 10 Feb 2026 05:16:31 +0000 (+0100) Subject: Remove purged adb names and entries from SIEVE list immediately X-Git-Tag: v9.21.19~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46cfac082555b02f44c3d6c4f8a2925c07d99b6c;p=thirdparty%2Fbind9.git 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(). --- diff --git a/lib/dns/adb.c b/lib/dns/adb.c index 2e61c755341..217356fd27b 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); + } } }