2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

Merge branch '3801-reduce-memory-bloat-caused-by-delayed-view-detach' into 'main'

Detach the views in zone_shutdown(), not in zone_free()

Closes #3801

See merge request isc-projects/bind9!7382
This commit is contained in:
Ondřej Surý 2023-01-17 21:47:14 +00:00
commit 71f13b9ad9
4 changed files with 19 additions and 7 deletions

View File

@ -1,3 +1,7 @@
6069. [bug] Detach from the view in zone_shutdown() to
release the memory held by the dead view
early. [GL #3801]
6068. [bug] Downloading a zone via TLS from a server which does
not negotiate "dot" ALPN token could crash BIND
on shutdown. That has been fixed. [GL #3767]

View File

@ -6900,6 +6900,7 @@ add_keydata_zone(dns_view_t *view, const char *directory, isc_mem_t *mctx) {
dns_zone_attach(pview->managed_keys,
&view->managed_keys);
dns_zone_setview(pview->managed_keys, view);
dns_zone_setviewcommit(pview->managed_keys);
dns_view_detach(&pview);
dns_zone_synckeyzone(view->managed_keys);
return (ISC_R_SUCCESS);

View File

@ -35,7 +35,9 @@ Feature Changes
Bug Fixes
~~~~~~~~~
- None.
- A constant stream of zone additions and deletions via ``rndc reconfig`` could
cause increased memory consumption due to delayed cleaning of view memory.
This has been fixed. :gl:`#3801`
Known Issues
~~~~~~~~~~~~

View File

@ -1246,6 +1246,8 @@ zone_free(dns_zone_t *zone) {
INSIST(zone->readio == NULL);
INSIST(zone->statelist == NULL);
INSIST(zone->writeio == NULL);
INSIST(zone->view == NULL);
INSIST(zone->prev_view == NULL);
if (zone->task != NULL) {
isc_task_detach(&zone->task);
@ -1253,12 +1255,6 @@ zone_free(dns_zone_t *zone) {
if (zone->loadtask != NULL) {
isc_task_detach(&zone->loadtask);
}
if (zone->view != NULL) {
dns_view_weakdetach(&zone->view);
}
if (zone->prev_view != NULL) {
dns_view_weakdetach(&zone->prev_view);
}
/* Unmanaged objects */
while (!ISC_LIST_EMPTY(zone->setnsec3param_queue)) {
@ -14737,6 +14733,15 @@ zone_shutdown(void *arg) {
LOCK_ZONE(zone);
INSIST(zone != zone->raw);
/* Detach the views early, we don't need them anymore */
if (zone->view != NULL) {
dns_view_weakdetach(&zone->view);
}
if (zone->prev_view != NULL) {
dns_view_weakdetach(&zone->prev_view);
}
if (linked) {
isc_refcount_decrement(&zone->irefs);
}