arcane icon indicating copy to clipboard operation
arcane copied to clipboard

🐞 Bug: CPU and RAM usage in an LXC container is incorrect.

Open mplok1 opened this issue 1 year ago • 18 comments

Bug Description

The CPU and RAM usage in an LXC container are incorrect. The system overview displays the Host values ​​instead of the LXC values.

The values ​​for the Docker engine part are good.

Steps To Reproduce

  • Add an Arcade environment located in an LXC
  • Go to Dashboard / System Overview of the env and check CPU and RAM usage.

Expected Behavior

The system overview for the environment should display the LXC values.

Actual Behavior

The system overview for the environment display the Host values.

Screenshots

No response

Arcane Version

1.8.1

Operating System

Linux

Browser

Chrome

Docker Version

29.0.0

Additional Context

No response

mplok1 avatar Nov 15 '25 18:11 mplok1

@mplok1 Can you try this image and see if this is fixed? ghcr.io/getarcaneapp/arcane:cgroups

kmendell avatar Nov 16 '25 02:11 kmendell

Hi,

I think there are still issues with the cgroups tag and consequently with the v1.9.0.

For example, my LXC only has 1 CPU and 1 GB of RAM, but the preview shows 12 CPUs and 13.5 GB / 31.09 GB, which corresponds more closely to the host's values. The usage percentages seem correct, unlike the limits :

Image

Conversely, the preview of my host, i.e., Docker Local, shows 2 CPUs and 37 MB / 4 GB 😨 :

Image

I have the impression that there are missing containers in the calculations.

For your information, my host machine is powered by Truenas 25.10

mplok1 avatar Nov 17 '25 20:11 mplok1

Ill take a closer look into this tonight, cgroups are kind of new to me still so im sure i missed something.

kmendell avatar Nov 17 '25 21:11 kmendell

@mplok1 Can you try this image please? ghcr.io/getarcaneapp/arcane:cgroups

kmendell avatar Nov 19 '25 03:11 kmendell

This is better for the limits of the Host but still incorrect regarding those of the LXC :

Image

I only have 1CPU / 1GB for the LXC

mplok1 avatar Nov 19 '25 08:11 mplok1

@mplok1 Can you try ghcr.io/getarcaneapp/arcane:cgroups again please, make sure to have LOG_LEVEL=debug enabled as well as this will print out some debug statments if its detects cgroups or not

kmendell avatar Nov 19 '25 21:11 kmendell

@mplok1 Can you try ghcr.io/getarcaneapp/arcane:cgroups again please, make sure to have LOG_LEVEL=debug enabled as well as this will print out some debug statments if its detects cgroups or not

It seems that version 1.8.1 doesn’t have this issue, but starting from 1.9.0 the display becomes incorrect.

Ainndy avatar Nov 20 '25 05:11 Ainndy

@kmendell It's still not working.

Here are the logs:

Nov 20 20:24:20.311 DBG Detected virtualization guest role
Nov 20 20:24:20.311 DBG Refreshing cgroup limits
Nov 20 20:24:20.312 DBG Cgroup stats are nil, assuming no limits
Nov 20 20:24:20.312 DBG Detected cgroup limits memory_limit=-1 cpu_count=-1

mplok1 avatar Nov 20 '25 20:11 mplok1

@mplok1 Can you try ghcr.io/getarcaneapp/arcane:cgroups again please, make sure to have LOG_LEVEL=debug enabled as well as this will print out some debug statments if its detects cgroups or not

It seems that version 1.8.1 doesn’t have this issue, but starting from 1.9.0 the display becomes incorrect.

Correct cause 1.9.0 added the cgroups utility. I will most likley revert the cgroups data for the stats on the next udpate till we can get this sorted out correctly.

kmendell avatar Nov 20 '25 21:11 kmendell

@mplok1 Can you try ghcr.io/getarcaneapp/arcane:cgroups again please, make sure to have LOG_LEVEL=debug enabled as well as this will print out some debug statments if its detects cgroups or not

It seems that version 1.8.1 doesn’t have this issue, but starting from 1.9.0 the display becomes incorrect.

Correct cause 1.9.0 added the cgroups utility. I will most likley revert the cgroups data for the stats on the next udpate till we can get this sorted out correctly.

Also, ghcr.io/getarcaneapp/arcane:cgroups is showing the CPU and memory usage of the host machine, not the CPU and memory usage of the LXC where Docker is installed.

Image Image

Ainndy avatar Nov 21 '25 00:11 Ainndy

Are these provelegded or unprivliged LXC's? I think it should work if its Unprivilegded but the way /premise fo what privigled does it passes the values from the host, and that could get messy depending on what platform its on Proxmox, TruenNAS etc.

kmendell avatar Nov 21 '25 18:11 kmendell

Are these provelegded or unprivliged LXC's? I think it should work if its Unprivilegded but the way /premise fo what privigled does it passes the values from the host, and that could get messy depending on what platform its on Proxmox, TruenNAS etc.

unprivileged LXC containers

mplok1 avatar Nov 22 '25 09:11 mplok1

  1. Mount the cgroup and proc folder from lxc into the container
  2. Set host to pid from container (agents)
  3. See the magic.
    pid: host (only agents)
    volumes:
      - /proc:/proc
      - /sys/fs/cgroup:/sys/fs/cgroup:ro (only arcane)

Tip: You can also use the same method for agents. Note: There may be a slight difference between this and the Proxmox dashboard. I believe it is related to the cache memory.

Image Image

fklnc94 avatar Nov 25 '25 20:11 fklnc94

@fklnc94 What image did you use to test?

kmendell avatar Nov 29 '25 19:11 kmendell

@fklnc94 What image did you use to test?

I am on 1.9.0.

fklnc94 avatar Nov 29 '25 19:11 fklnc94

@fklnc94 Not the custom build i created just the normal latest or v1 tag correct? Just want to make sure as if thats the fix, then ill close this and update the documentation and close the PR for the part 2 fix.

kmendell avatar Nov 30 '25 00:11 kmendell

@fklnc94 Not the custom build i created just the normal latest or v1 tag correct? Just want to make sure as if thats the fix, then ill close this and update the documentation and close the PR for the part 2 fix.

Yeah, its main branch v1.9.0, This issue has nothing to do with Arcane. It is entirely related to LXC. If you bind the /proc directory, which is virtualised by Proxmox and transferred to LXC, to your Docker container, you will see that the issue is resolved.

fklnc94 avatar Nov 30 '25 00:11 fklnc94

Updated the documentation here: f3002da.

Thank you everyone for the troubleshooting and help.

kmendell avatar Nov 30 '25 02:11 kmendell