Open erickweil opened 1 year ago
Hi @erickweil, my apologies for the belated response, somehow this issue fall off our radar. We are currently trying to prioritize Sysbox's functional issues, so it may take us some extra time to fix this one. Btw, I can see you have some familiarity with cgroups, so let us know if you have cycles (or interest) to fix this one yourself. We would really appreciate it.
For other people looking for temporary solutions until this is solved, the below bash script does the job of showing the memory usage, in bytes.
CONTAINERS=$(docker ps -q --no-trunc)
for c in $CONTAINERS; do
cat /sys/fs/cgroup/system.slice/docker-$c.scope/memory.current
done
But if you want a more readable output, below is a python program that displays in a table the above info, parsed into readable memory amounts. https://gist.github.com/erickweil/575eb6d027db647c1a8a2efb0195fe87
Setting systemd.unified_cgroup_hierarchy=0
in grub fixes the issue. Is there any disadvantages of this?
@ctalledo I am planning to use this setting since my app relies on docket stats for a lot of tasks. Please guild me if adding this in grub and making systemd use cgroupv2 has any immediate consequences?
Hi @sibidharan, thanks for following up and apologies for the belated response.
Setting systemd.unified_cgroup_hierarchy=0 in grub fixes the issue.
That's interesting and means the problem only occurs with cgroups v2 (not cgroups v1).
Is there any disadvantages of this?
No major disadvantages for Sysbox containers, but going forward the direction is to move to cgroups v2, so we need to fix it.
The
docker stats
command seems fundamentally flawed on sysbox containers, not showing changes in either cpu and memory usage, always stays on 1 PID, also not catching the limit when running with --memory constraint.The issue https://github.com/nestybox/sysbox/issues/303 marked this as solved, but I found this problem still happening on my tests.
Steps
Look how the sysbox container wrongly show only 2.2M of memory usage, and there is no change on that, the container could be using Gigabytes of RAM but still a few Mb is shown.
the problem doesn't affect the 'normal' runc containers, showing correct ammounts of memory usage.
The system info on sys/fs/cgroup does show the correct ammounts:
System info
The test was run in a ubuntu virtual machine, with the following specs:
As a side question, what is the recommended OS version and kernel version for running sysbox runtime?