From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id AC68B1FF0AF for ; Fri, 06 Nov 2026 01:54:17 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 5A47721A39; Fri, 06 Nov 2026 01:51:09 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v3 manager 46/76] pvestatd: track pending storage status commands across re-exec Date: Fri, 6 Nov 2026 00:31:21 +0100 Message-ID: <20261105233336.2178064-47-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261105233336.2178064-1-t.lamprecht@proxmox.com> References: <20261105233336.2178064-1-t.lamprecht@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1793926180591 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.318 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: VQWXAQL5XGRMIT4VEEX7XYJCE6HBDQPH X-Message-ID-Hash: VQWXAQL5XGRMIT4VEEX7XYJCE6HBDQPH X-MailFrom: t.lamprecht@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Storage status commands that outlive their budget must be reaped later. pvestatd re-exec preserves its children but loses their tracking records, leaving them as zombies once they exit. Pass the records through the environment across re-exec. Reap children on every pass, even if no remaining storage starts new status commands. Signed-off-by: Thomas Lamprecht --- PVE/Service/pvestatd.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm index cec66e001..f682c2f9d 100755 --- a/PVE/Service/pvestatd.pm +++ b/PVE/Service/pvestatd.pm @@ -20,6 +20,7 @@ use PVE::RS::SDN::Fabrics; use PVE::NodeConfig; use PVE::Cluster qw(cfs_read_file); use PVE::Storage; +use PVE::Storage::StatusCommand; use PVE::QemuServer; use PVE::QemuServer::Monitor; use PVE::LXC; @@ -74,6 +75,15 @@ sub hup { $restart_request = 1; } +# The status commands that a pass left behind, see PVE::Storage::StatusCommand, stay children of +# this process across a re-exec, but the record of them does not, so hand it over. +sub restart_daemon { + my ($self, @param) = @_; + + $ENV{PVE_STORAGE_STATUS_COMMANDS} = PVE::Storage::StatusCommand::export_pending(); + $self->SUPER::restart_daemon(@param); +} + my $cached_kvm_version = ''; my $next_flag_update_time; my $failed_flag_update_delay_sec = 120; @@ -871,10 +881,15 @@ my $initial_memory_usage; sub run { my ($self) = @_; + PVE::Storage::StatusCommand::import_pending(delete $ENV{PVE_STORAGE_STATUS_COMMANDS}); + for (;;) { # forever $next_update = time() + $updatetime; + # reap left-over status commands even when no storage starts a new one + PVE::Storage::StatusCommand::reap_pending(); + if ($cycle) { my ($ccsec, $cusec) = gettimeofday(); eval { -- 2.47.3