Cgroup - Failed to destroy 10

We have investigated some memory issues on our servers and found that the cgroup_tree_remove function gets permission denied while trying to destroy containers:

lxc rico-02941862 20221025015932.108 WARN     cgfsng - ../src/src/lxc/cgroups/cgfsng.c:cgroup_tree_remove:489 - Permission denied - Failed to destroy 10(lxc.payload.rico-02941862)

Removing these manually could free up some memory, so definitely this is partially responsible for our problem.

Environment

$ uname -a
Linux 5.10.0-9-amd64 #1 SMP Debian 5.10.70-1 (2021-09-30) x86_64 GNU/Linux
$ lxc --version
5.6

How can we investigate this further and possibly resolve this issue?

Thank you in advance for the help.

Update: The issue most likely due to a bug in LXD. I opened an issue for further information on GitLab: cgroup is not removed when stopping container · Issue #11108 · lxc/lxd · GitHub