webmin icon indicating copy to clipboard operation
webmin copied to clipboard

fix: memory leak - remove circular reference in bind8 lib

Open Demayl opened this issue 8 years ago • 9 comments

Spotted when restoring from backup. So memory pressure when restoring is significantly reduced.

Demayl avatar Apr 06 '17 08:04 Demayl

I'm not so sure about this patch - it would mean that navigating down the named.conf parse tree and back up it wouldn't return to the same object.

jcameron avatar Apr 07 '17 04:04 jcameron

In worst case it must be rewritten. I tested it fast and it doesn't break anything, but something can count on this bug to work. This circular reference must be fixed, because leaked memory is huge ( around 12MB per domain restore ). In my opinion it doesn't rely on that mistake.

EDIT: Inner key 'values' in 'parent' is still a reference.

Demayl avatar Apr 07 '17 07:04 Demayl

When you say "domain restore", are you talking about Virtualmin backups and restores?

jcameron avatar Apr 08 '17 06:04 jcameron

Yes

Demayl avatar Apr 10 '17 06:04 Demayl

Ok, what confuses me is that this patch doesn't seem related to any code that is invoked as part of the backup or restore process - if there is a memory leak, it should happen any time DNS records are listed or edited by Virtualmin.

jcameron avatar Apr 11 '17 06:04 jcameron

Ok, you can try it too. It's a problem on long running operations ( like the restore ). Ops like list/edit are living short time.

Demayl avatar Apr 11 '17 06:04 Demayl

I wasn't able to re-produce this - how large is the named.conf file on your system?

jcameron avatar Apr 12 '17 03:04 jcameron

1663 records, 258K To reproduce this you must restore 2+ domains with DNS opt enabled

Demayl avatar Apr 12 '17 06:04 Demayl

So you have 1663 domains hosted by Virtualmin with DNS enabled? That's .... quite a lot.

But I'm still having trouble re-producing this issue, or seeing where the memory leak could be coming from. Even though the parsed named.conf structure has a loop, this on it's own shouldn't cause a leak unless it is serialized - which doesn't happen anywhere in the backup / restore code.

jcameron avatar Apr 16 '17 04:04 jcameron