mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-27 12:13:20 -04:00
Detach the views in zone_shutdown(), not in zone_free()
The .view (and possibly .prev_view) would be kept attached to the
removed zone until the zone is fully removed from the memory in
zone_free(). If this process is delayed because server is busy
something else like doing constant `rndc reconfig`, it could take
seconds to detach the view, possibly keeping multiple dead views in the
memory. This could quickly lead to a massive memory bloat.
Release the views early in the zone_shutdown() call, and don't wait
until the zone is freed.
(cherry picked from commit 13bb821280)
This commit is contained in:
parent
5d41338e9c
commit
f8b7188a42
1 changed files with 11 additions and 6 deletions
|
|
@ -1236,6 +1236,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);
|
||||
|
|
@ -1243,12 +1245,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)) {
|
||||
|
|
@ -15023,6 +15019,15 @@ zone_shutdown(isc_task_t *task, isc_event_t *event) {
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue