Project

General

Profile

Actions

Bug #10624

closed

Memory leak in Unbound with Python module and DHCP lease registration active

Added by Adrien Carlyle over 4 years ago. Updated almost 2 years ago.

Status:
Resolved
Priority:
Normal
Category:
DNS Resolver
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
23.01
Release Notes:
Default
Affected Version:
2.4.5
Affected Architecture:
All

Description

Issue reported and diagnosed on forums here: Was able to see evidence of this on SG-1100 and SG-3100.
https://forum.netgate.com/topic/154113/sg-1100-2-4-5-unbound-python-module-dhcp-lease-dns-registration-memory-leak

TLDR: When an unbound python module is configured, and the "Register DHCP leases in the DNS resolver" option is enabled. DHCP clients joining the network cause unbound memory usage to increase each time.

If I disable either the python module, or the option to register leases, things appear to function normally.


Related issues

Related to Bug #5413: Reduce disruptions when changing DNS records from DHCP leases in UnboundResolvedChristian McDonald11/10/2015

Actions
Related to Regression #11316: Unbound crashes with signal 11 when reloadingResolvedChristian McDonald

Actions
Actions #1

Updated by Jim Pingle over 4 years ago

  • Subject changed from Unbound configuration memory leak to Unbound configuration memory leak with python module + register DHCP leases active
Actions #2

Updated by Jim Pingle over 3 years ago

This would likely be fixed by also solving #5413 since it wouldn't restart in this case. Though the actual memory leak should be re-tested on unbound 1.13.1 and if it's still present, it should be reported upstream to the Unbound devs.

Actions #3

Updated by Jim Pingle over 3 years ago

  • Related to Bug #5413: Reduce disruptions when changing DNS records from DHCP leases in Unbound added
Actions #4

Updated by Christian McDonald almost 2 years ago

  • Assignee set to Christian McDonald
Actions #5

Updated by Christian McDonald almost 2 years ago

  • Status changed from New to Confirmed

This is confirmed.

Python3.9 and lower has some deeply rooted memory management problems. Because of the way Unbound reinitializes the Python context every time Unbound is reloaded via unbound-control reload or kill -HUP, some memory is leaked.

Moving to Python3.10+ greatly improves this situation.

Actions #6

Updated by Jim Pingle almost 2 years ago

Actions #7

Updated by Christian McDonald almost 2 years ago

https://github.com/NLnetLabs/unbound/pull/827

We also need Unbound to quit reloading the interpreter on every SIGHUP/reload. This is unnecessary.

Actions #8

Updated by Christian McDonald almost 2 years ago

  • Target version set to 2.7.0
  • Plus Target Version set to 23.01
  • Release Notes set to Default
Actions #9

Updated by Christian McDonald almost 2 years ago

  • Affected Architecture All added
  • Affected Architecture deleted (SG-1100, SG-3100)
Actions #10

Updated by Christian McDonald almost 2 years ago

  • Status changed from Confirmed to Feedback

https://github.com/pfsense/FreeBSD-ports/commit/190a54b5581d5a20b5f839a8a01180d201883cab

This should be significantly improved.

Test the latest snapshots

Actions #11

Updated by Jim Pingle almost 2 years ago

  • Subject changed from Unbound configuration memory leak with python module + register DHCP leases active to Memory leak in Unbound with Python module and DHCP lease registration active
  • Start date deleted (06/02/2020)

Updating subject for release notes.

Actions #13

Updated by Jim Pingle almost 2 years ago

  • Status changed from Feedback to Resolved
  • % Done changed from 0 to 100

No reports of problems that I've seen since the fix is in place. If it recurs we can always reopen or start a fresh issue as needed.

Actions

Also available in: Atom PDF