From 85f5071a6db3ad6d107a4f751b64589aefa95a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 7 Dec 2022 16:45:33 +0100 Subject: [PATCH 1/2] Release unused key file IO lock objects Due to off-by-one error in zonemgr_keymgmt_delete, unused key file IO lock objects were never freed and they were kept until the server shutdown. Adjust the returned value by -1 to accomodate the fact that the atomic_fetch_*() functions return the value before the operation and not current value after the operation. (cherry picked from commit fb1acd6736609360f79a498d44dffcceb8ca0f54) --- lib/dns/zone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 47e506b7df..04891f509a 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -18959,7 +18959,7 @@ zonemgr_keymgmt_delete(dns_zonemgr_t *zmgr, dns_zone_t *zone) { if (dns_name_equal(kfio->name, &zone->origin)) { unsigned int count; - count = atomic_fetch_sub_relaxed(&kfio->count, 1); + count = atomic_fetch_sub_relaxed(&kfio->count, 1) - 1; if (count > 0) { /* Keep the entry. */ break; From f79a9c856c45049901f13c08ed7a95d745093b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 7 Dec 2022 16:52:07 +0100 Subject: [PATCH 2/2] Add CHANGES and release note for [GL #3727] (cherry picked from commit 56a997b0b5dab63b78d20abda0b6ba1ae3fcd2b1) --- CHANGES | 4 ++++ doc/notes/notes-current.rst | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGES b/CHANGES index 276060d935..d88bc3084f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +6043. [bug] The key file IO locks objects would never get + deleted from the hashtable due to off-by-one error. + [GL #3727] + 6042. [bug] ANY responses could sometimes have the wrong TTL. [GL #3613] diff --git a/doc/notes/notes-current.rst b/doc/notes/notes-current.rst index 9383fdc4d7..1a3ed8518a 100644 --- a/doc/notes/notes-current.rst +++ b/doc/notes/notes-current.rst @@ -73,6 +73,12 @@ Bug Fixes - The ``named`` would wait for some outstanding recursing queries to finish before shutting down. This has been fixed. :gl:`#3183` +- When a zone is deleted from a server, an key management objects related to + that zone would be kept in the memory and released only at the server + shutdown. This could lead to constantly increasing memory usage for servers + with a high zone churn. :gl:`#3727` + + Known Issues ~~~~~~~~~~~~