all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] vm status: guard get_memory_stat() call with eval
@ 2026-01-22 12:10 Fiona Ebner
  2026-01-23  8:25 ` [pve-devel] applied: " Fabian Grünbichler
  0 siblings, 1 reply; 2+ messages in thread
From: Fiona Ebner @ 2026-01-22 12:10 UTC (permalink / raw)
  To: pve-devel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH qemu-server] vm status: guard get_memory_stat() call with eval
  2026-01-22 12:10 [pve-devel] [PATCH qemu-server] vm status: guard get_memory_stat() call with eval Fiona Ebner
@ 2026-01-23  8:25 ` Fabian Grünbichler
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2026-01-23  8:25 UTC (permalink / raw)
  To: pve-devel, Fiona Ebner


On Thu, 22 Jan 2026 13:10:18 +0100, Fiona Ebner wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] vm status: guard get_memory_stat() call with eval
      commit: 61d76518025f0ef3f7c5e6525af0f68e11bfee60

Best regards,
-- 
Fabian Grünbichler <f.gruenbichler@proxmox.com>


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-23  8:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-22 12:10 [pve-devel] [PATCH qemu-server] vm status: guard get_memory_stat() call with eval Fiona Ebner
2026-01-23  8:25 ` [pve-devel] applied: " Fabian Grünbichler

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal