We are actually using some debian10 lxd hosts (lxd is installed via snapd) with no issue.
We are actually running more than 50 debian10 containers with no issue (except the journald tmpfs usage issue we fixed recently).
We are using kernel 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2+deb10u1 and lxd 4.6
We had to create couple of debian9 containers on them and encounter an issue with them both.
We can see these containers memory usage growing for no reason over time until there is no more memory left on the container.
We are using images:debian/9/cloud images from lxd official repository.
We didn’t tweak anything.
Memory used is not cache or buffer. We stopped all non-system process on containers but still memory is used by something and we have no clue what.
On both the usage is increasing very regularly and they both use their 2G memory after 19 hours running.
Only processes running on them are
That’s exactly the point… top or htop are not showing any process using all the ram… If I sum-up all the process RSS used, I get almost the same amount of RAM used at the container startup (almost 300Mb).
I have no clue what is actually using all this RAM.
Also I do not see any tmpfs filesystem used more than some megabytes (see below my df -h output)
Thats very interesting .
I guess @tomp will be more helpful than me, but…
Are there “suspicious” activities on the host?
So you didn’t install or modify anything at all?
I assume you have limited their memory via LXD?
Have tried to run a new debian container (by which I mean a new build of debian9 container)?
And have you tried the non-cloud variant?
(Both for reasons of comparison obviously.)
I didn’t see anything suspiscious on containers.
I have created 2 containers the same way on 2 different hosts (debian10 hosts + debian 9 containers each time) and was able to reproduce issue on all containers.
Yes I have created containers using lxd and have only set CPU and RAM limits using lxd profiles.
I also have setup network and some dhcp conf using user.network-config and user.user-data.
I didn’t try the non cloud variants yet.
I will spend some time during the next days on this subject and will try the non-cloud variants
Also note that the 2 containers I created were monitored using shinken by ssh so there was regularly ssh connections opened in the container.
I also tested same configuration on virtual machines created with lxd still on same hosts and with debian/9/cloud image and issue is not happening at all.
Just tested smem quickly on the only remaining debian9 container I have which is also a jenkins slave server so with a java process running on it (and some go binaries like consul).
I will add smem to my tests I will do tomorrow and the next days
free is actually reporting 917Mb RAM used on 1.9Gb.
# free -m
total used free shared buff/cache available
Mem: 1907 917 543 35 445 989
Swap: 0 0 0
smem is reporting like all others way less memory used than kernel
Ok, thats valuable information.
Suggests that it has something to do with the specific (container) image or LXC .
But as always: correlation is not necessarily causation.
Would also be interesting to see whether a different kernel version works.
Or at least a more recent 4.19 version, current is 4.19.152.
I did some tests today. I have created 2 new containers (1 cloud + 1 default image) with minimum changes inside to check if I can reproduce on them.
I found something interesting, on my lxd hosts (ovh servers with 32Gb RAM) I can see similar memory leak.
Example: I have one host with 32Gb of RAM hosting 10 containers with 1Gb RAM limit (and they are all not using their complete quota) and 2 qemu virtual machines (1 with 2Gb RAM and one with 3Gb RAM). The host announced 27Gb RAM used which is way more than expected. And if I sumup all the RSS of processes actually running I got 6Gb. So here no debian9 involved anywhere as all containers are debian10 like the host.
So I investigated a bit and found kernel was not up-to-date because of ovh installer. I updated it (from 4.19.118-2+deb10u1 to 4.19.152-1) and will keep this topic updated with my discoveries
OK so after updating kernel on my lxd hosts and monitoring memory usage, I can say that it fixed my issue. I no longer see memory leak on my containers or my hosts.
Issue was that OVH is not installing linux-image-amd64 metapackage on their linux installs but specific kernel version.
So I had to install the meta-package and now my kernel will be kept updated on all my hosts with apt.
Thank you again for time spent listening to me and giving me useful hints on how to fix our issue