From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server] vm status: guard get_memory_stat() call with eval
Date: Thu, 22 Jan 2026 13:10:18 +0100 [thread overview]
Message-ID: <20260122121053.80464-1-f.ebner@proxmox.com> (raw)
While in practice, it should be quite rare and unexpected for the
get_memory_stat() to fail, a single failing call should not fail the
whole pvestatd collection for VMs or even the single
'/qemu/{vmid}/status/current' API call for the affected VM, which e.g.
leads to the display for the VM in the UI being inaccessible.
One situation where it can happen is manually invoking the command
given by 'qm showcmd', because the process won't be part of the usual
systemd scope.
Fixes: 551c0078 ("fix #6935: vmstatus: use CGroup for host memory usage")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PVE/QemuServer.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index fc735aa3..7a0a2606 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -2589,7 +2589,8 @@ sub vmstatus {
$d->{uptime} = int(($uptime - $pstat->{starttime}) / $cpuinfo->{user_hz});
my $cgroup = PVE::QemuServer::CGroup->new($vmid);
- my $cgroup_mem = $cgroup->get_memory_stat();
+ my $cgroup_mem = eval { $cgroup->get_memory_stat() } // {};
+ warn "unable to get memory stat for $vmid - $@" if $@;
$d->{memhost} = $cgroup_mem->{mem} // 0;
$d->{mem} = $d->{memhost}; # default to cgroup, balloon info can override this below
--
2.47.3
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next reply other threads:[~2026-01-22 12:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 12:10 Fiona Ebner [this message]
2026-01-23 8:25 ` [pve-devel] applied: " Fabian Grünbichler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260122121053.80464-1-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.