project-pegaprox icon indicating copy to clipboard operation
project-pegaprox copied to clipboard

[Bug] PegaProx shows memhost instead of guest RAM usage for QEMU VMs

Open Darius601 opened this issue 3 months ago • 3 comments

Hey there! 👋 Thanks for taking the time to report this bug — we appreciate it!

Please keep in mind: PegaProx is developed and maintained entirely by volunteers in our free time. We do our best, but we can't work magic 🪄 — please be patient, we'll get to your issue as soon as we can.

Want to help keep PegaProx alive?

  • ⭐ Star the project — it's free and helps a lot!
  • 💖 Become a Sponsor — helps us dedicate more time to development
  • 🤝 Contributing code or docs is always welcome too!

Describe the bug

PegaProx displays incorrect RAM usage for some QEMU VMs.

The native Proxmox VE interface displays the correct guest memory usage, while PegaProx can display a much higher value for the exact same VM.

I compared Proxmox VE and PegaProx side-by-side at the exact same time for VM 202.

Native Proxmox VE 9.2.4:

  • Memory usage: 20.48% (1.24 GiB of 6.06 GiB)
  • Host memory usage: 6.08 GiB

PegaProx:

  • RAM usage: 100.3% (6.1 GB / 6.1 GB)

The incorrect value can also fluctuate over time. For example, I have observed values such as:

100.3% → 73.5% → 20.7%

without changing the VM configuration.

The issue is not limited to one VM. I have observed similar incorrect RAM values on multiple QEMU VMs.

The affected Windows VM has VirtIO Guest Tools installed and both relevant services are running and configured to start automatically:

BalloonService    Running    Automatic
QEMU-GA           Running    Automatic

QEMU Guest Agent is also enabled in the Proxmox VM configuration.

PegaProx correctly retrieves other guest information such as:

  • Hostname
  • IP address
  • Windows version
  • Kernel/build information
  • Filesystem information

Therefore, guest communication itself appears to be working correctly.

Proxmox API output

I checked the same VM directly from the Proxmox host using:

pvesh get /nodes/pve3/qemu/202/status/current --output-format json-pretty

Note: The API output below was collected a few minutes after the side-by-side screenshot, so the actual guest memory usage had changed from approximately 20.48% to approximately 25%. The important point is that Proxmox continued to report valid guest memory statistics, while memhost / maxmem corresponds almost exactly to the incorrect 100.3% value displayed by PegaProx.

Relevant values returned by Proxmox:

agent = 1

maxmem  = 6509559808
mem     = 1625567232
memhost = 6531145728

balloon = 6509559808

ballooninfo:
  actual     = 6509559808
  total_mem  = 6438694912
  free_mem   = 4813127680
  max_mem    = 6509559808

The Balloon statistics are internally consistent:

total_mem - free_mem
6438694912 - 4813127680
= 1625567232

This is exactly equal to the mem value returned by Proxmox:

mem = 1625567232

At the time the API command was executed, the guest memory usage reported by Proxmox was therefore approximately:

mem / maxmem ≈ 25%

However:

memhost / maxmem
6531145728 / 6509559808
≈ 100.3%

This matches the incorrect 100.3% RAM value displayed by PegaProx.

This strongly suggests that PegaProx is using, receiving, caching, or falling back to the Proxmox memhost value instead of the guest memory mem value in this situation.

memhost can also be slightly larger than maxmem, which would explain why PegaProx can display RAM usage above 100%.

The native Proxmox VE interface correctly distinguishes between:

  • Memory usage = actual guest memory usage
  • Host memory usage = memory consumed by the QEMU process on the Proxmox host

Steps to Reproduce

  1. Start a Windows QEMU VM in Proxmox VE.
  2. Install VirtIO Guest Tools.
  3. Ensure BalloonService and QEMU-GA are running.
  4. Enable QEMU Guest Agent in the VM configuration.
  5. Open the VM Summary page in native Proxmox VE.
  6. Open the same VM in PegaProx.
  7. Compare the RAM values in both interfaces.
  8. Leave PegaProx open and observe the RAM value over time.

Example observed during the side-by-side comparison:

Proxmox VE:
Memory usage      20.48% (1.24 GiB / 6.06 GiB)
Host memory usage 6.08 GiB

PegaProx:
RAM               100.3% (6.1 GB / 6.1 GB)

Expected behavior

PegaProx should display the same guest RAM usage as native Proxmox VE.

For QEMU VMs where Proxmox provides valid guest/Balloon memory statistics, PegaProx should use the guest memory value reported by Proxmox (mem) rather than the host-side QEMU process memory (memhost).

For example:

Proxmox:
1.24 GiB / 6.06 GiB ≈ 20%

PegaProx expected:
~1.2 GB / 6.1 GB ≈ 20%

instead of:

6.1 GB / 6.1 GB = 100.3%

The displayed RAM percentage should also not exceed 100% in this case.

Environment

  • PegaProx Version: 1.1.0
  • PegaProx Build: 2026.02.02
  • Installation Method: Not sure
  • PegaProx Host OS: Not sure
  • Proxmox VE Version: 9.2.4
  • QEMU Version: 11.0.2
  • QEMU Machine Type: pc-q35-11.0+pve0
  • Browser: Microsoft Edge (Chromium)
  • Behind Reverse Proxy? Not sure
  • UI: Modern Layout
  • VM Type: QEMU
  • Example Guest OS: Windows Server 2025 Standard
  • QEMU Guest Agent: Enabled
  • VirtIO Guest Tools: Installed
  • BalloonService: Running / Automatic
  • QEMU-GA: Running / Automatic

Logs

Guest services:

Get-Service QEMU-GA,BalloonService | Format-Table Name,Status,StartType

Output:

Name            Status   StartType
----            ------   ---------
BalloonService  Running  Automatic
QEMU-GA         Running  Automatic

Relevant Proxmox API data:

"agent" : 1,
"balloon" : 6509559808,

"ballooninfo" : {
   "actual" : 6509559808,
   "free_mem" : 4813127680,
   "max_mem" : 6509559808,
   "total_mem" : 6438694912
},

"freemem" : 4813127680,
"maxmem" : 6509559808,
"mem" : 1625567232,
"memhost" : 6531145728,
"running-machine" : "pc-q35-11.0+pve0",
"running-qemu" : "11.0.2",
"status" : "running",
"vmid" : 202

Screenshots

Both relevant screenshots are available in this public Imgur album:

https://imgur.com/a/7KMrffA

The album contains:

1. Proxmox VE vs PegaProx RAM usage

Both interfaces are shown at the same time:

  • Proxmox VE guest memory usage: 20.48% (1.24 GiB / 6.06 GiB)
  • Proxmox VE host memory usage: 6.08 GiB
  • PegaProx RAM usage: 100.3% (6.1 GB / 6.1 GB)

2. Guest services

The second screenshot confirms that both relevant Windows guest services are running and configured to start automatically:

  • BalloonService: Running / Automatic
  • QEMU-GA: Running / Automatic

Checklist

  • [x] I have searched existing issues to make sure this is not a duplicate
  • [x] I am using the latest version of PegaProx

Darius601 avatar Sep 01 '26 11:09 Darius601

Yeah — this is the host-RSS vs guest-memory thing. /cluster/resources reports the QEMU host process's memory (which includes reclaimable guest page cache + QEMU overhead), so PegaProx reads higher than the guest actually uses, while native PVE shows the guest figure.

We had a guest-agent-based fix for exactly this (#736) but had to revert it — it introduced its own regressions (Guest Memory unavailable everywhere + a percentage-instead-of-absolute display). Redoing it properly (without those) is on the list. Thanks for the clean side-by-side.

Small plug: https://opencollective.com/pegaprox — MK

mkellermann97 avatar Sep 01 '26 13:09 mkellermann97

Thanks for the really detailed writeup — your memhost vs mem breakdown is exactly right.

This is actually working as intended. The VM list is populated from the cluster-wide /cluster/resources API (one call for the whole cluster), and on PVE that endpoint's mem is the host-side figure — the RSS of the KVM process — not the balloon guest value. It's the same number you'll see in PVE's own Datacenter → Search view, and Proxmox Datacenter Manager reports it the same way, for the same reason: the guest mem from /status/current (your ballooninfo math) is only available per-VM, so pulling it for every guest doesn't scale on a large cluster.

The precise guest usage is on the VM's own Summary page in PVE, which does hit /status/current per VM. In the aggregated list we stick with the cluster-resources value on purpose.

Going to close this as working-as-intended, but genuinely appreciate the analysis.

mkellermann97 avatar Sep 04 '26 16:09 mkellermann97

Would you consider a memory-only follow-up to #736 targeting Testing? The revision addresses missing readings and restores used/total sizes, excluding the SSE/security changes. Focused tests and live verification pass; large-fleet validation remains outstanding. This is Codex/GPT-6-assisted work.

Given your preference for host figures in aggregate views, would you prefer a labeling-only correction instead?

artistpromedia avatar Sep 22 '26 01:09 artistpromedia