Possible nasty memory leak involving jails

Borja Marcos

Contributor
Joined
Nov 24, 2014
Messages
125
Hi,

I haven't created a proper bug report because I don't have decent data yet. So take this as a "ring a bell" thing.

Server with 16 GB of memory running CORE (13.0-U6.1). It has several jails running somewhat heavy stuff (One with Opensearch, another one with Plex, another one with LibreNMS which means nginx+php+mysql).

It works like a charm, so no complaints.

However, when compiling a heavy port (MongoDB) inside a jail Inactive memory skyrocketed. Up to 9 GB! Which of course applied an enormous pressure on the ZFS ARC.

In the past, facing this situation, I had rebooted the machine and of course it had gone back to normal. This time I have tried to "solve" it by stopping stuff. So I stopped the jails. No success.

The surprise has come when, after restarting the jails (inactive memory was still insanely high!) I have gone to the mongodb port directory and I have done a "make clean".

POOF! Inactive memory back to normal levels.

Remember that I hadn't stopped the server, just the jails.

So, hypothesis:

- Files created from inside a jail get somewhat "sticky" as inactive memory (cache?).

- For some reason that inactive memory is nore reclaimed even if stopping the jails.

- Restarting the jail and doing a "make clean" somewhat "finds" memory associated to those files and, when deleting them, actually purges that inactive memory.

Screenshot 2024-02-06 at 12.46.42.png


The huge drop in inactive memory is the "make clean". The new inactive level is so low maybe because, before the make clean, I was playing with sysctl vm.v_inactive_target.

Now, if this rings a bell I may arrange for some more tests. I have commented on a FreeBSD bug, 256507 which might be somewhat related.
 
Top