It looks like the LXD 5.21 has a memory leak as a result of executing LXC commands.
I’ve made the following simple test:
- LXD with just one running container
- I run a script that executes ‘lxc exec – ls >/dev/null’ each 2 sec
- another script that monitors the RSS values in the /proc/<LXD_PID>/status file.
After one day of running:
*****Tue Oct 8 03:18:44 PM UTC 2024
VmRSS: 173892 kB
RssAnon: 125636 kB
RssFile: 48256 kB
RssShmem: 0 kB
.........
*****Wed Oct 9 01:29:09 PM UTC 2024
VmRSS: 206708 kB
RssAnon: 157940 kB
RssFile: 48768 kB
RssShmem: 0 kB
We are using LXD as a part of our product and we have a service that periodically scans the containers and pulls the required data from them by running the LXC commands. The typical server has up to 150 containers. So, the memory leak becomes to be a “time bomb”.
The same problem I saw in LXD 3.0.3 in Ubuntu 18.04. As a workaround, I have to periodically restart the LXD service to reclaim the memory back.
Now with 5.21, the LXD service restarting causes the containers to restart and we can not afford it.
Does somebody know if the problem exists also in 6.x version?
Is it possible to install the old LXD 3.0.3 or 3.0.4 on Ubuntu 24.04?
Is there an alternative way to execute a command inside a container and get the result without involving LXD?
Thank you.