# BIND 9.16 (named) :: Possible Memory Leak ?!



## mg16373 (Mar 24, 2021)

I'm running the following version:
BIND 9.16.13 (Stable Release) <id:072e758>
running on FreeBSD amd64 12.2-RELEASE-p4 FreeBSD 12.2-RELEASE-p4 GENERIC

Since this version 9.16.x is running on my server the process memory blows up to 52 GB (TOP: SIZE/RES column) of memory. Some configuration options to limit the cache memory fails but now I have used the option "-M" with the value "external". After the named process was restarted the memory is pinned at 125 MB of memory. Have anybody the same issue? My nameserver is NOT under heavy load.


```
Here the part of "named" manual:
-M option
              This option sets the default memory context options. If set to
              "external", the internal memory manager is bypassed in favor of
              system-provided memory allocation functions. If set to "fill",
              blocks of memory are filled with tag values when allocated or
              freed, to assist debugging of memory problems. nofill disables
              this behavior, and is the default unless named has been compiled
              with developer options.
```


----------



## PMc (Mar 24, 2021)

That rings bells. I had serious memory bloat issues since a couple of recent versions of bind. 

My issue came from greatly expanded zone statistics, and has to be workarounded with `zone-statistics terse;`


----------



## SirDice (Mar 24, 2021)

Last update actually fixed a memory leak: https://downloads.isc.org/isc/bind9/9.16.13/doc/arm/html/notes.html#notes-for-bind-9-16-13

But it's possible there are more of course. I haven't noticed anything with this or previous versions. There's some memory in use, but this doesn't seem to grow much, if at all. Which does beg the question, how are things configured?


----------



## trev (Mar 24, 2021)

```
Mar 22 18:01:04 shadow pkg-static[82675]: bind916-9.16.12 deinstalled
Mar 22 18:01:10 shadow pkg-static[82874]: bind916-9.16.13 installed

PID USERNAME    THR PRI NICE   SIZE    RES  STATE    C   TIME    WCPU COMMAND
82951 bind        14    52    0       188M   152M sigwai      0   1:20       0.00% named

ps -ax | grep named
82951  -  Is        1:20.64 /usr/local/sbin/named -u bind -c /usr/local/etc/namedb/named.conf

grep named /etc/rc.conf
named_enable="YES"
```

Doesn't seem any different to me,


----------



## leres (Apr 11, 2021)

I'm seeing this issue as well on an authoritative nameserver with only a few small zones. I'm not using it for recursion, I have an unbound instance running for that.

After only four days of uptime top reported the RES size as 10G. I've added `zone-statistics terse` but what should I look at if that doesn't solve it?


----------



## boss_aus (Apr 23, 2021)

Same problem for me, it grows until used all swap then killed by the system.
bind916-9.16.13
FreeBSD 12.2-RELEASE-p3


----------



## leres (Apr 23, 2021)

PMc said:


> That rings bells. I had serious memory bloat issues since a couple of recent versions of bind.
> 
> My issue came from greatly expanded zone statistics, and has to be workarounded with `zone-statistics terse;`


I made this change on two systems almost two weeks ago so far it has solved the issue for me.


----------



## danbi (Apr 30, 2021)

I have the same problem with named 9.16.13, used as recursive resolver. Not seen on non-recursive servers. It was fixed by adding


```
named_flags="-M external"
```

to /etc/rc.conf. Playing with zone-statistics did not help.

Interesting this only occurs on 12-stable. It doesn't occur on 11-stable, identical config and usage.


----------

