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 600591FF0AA for ; Fri, 04 Sep 2026 09:25:47 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 0210E21491; Fri, 04 Sep 2026 09:25:47 +0200 (CEST) From: Hannes Laimer To: pve-devel@lists.proxmox.com Subject: [PATCH pve-common] rest environment: start each worker task with a clean warning count Date: Fri, 4 Sep 2026 09:25:35 +0200 Message-ID: <20260904072535.501236-1-h.laimer@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1788506739088 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.662 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: W6RMNZEODZC66ONWLTULQCNGMRW2VA5V X-Message-ID-Hash: W6RMNZEODZC66ONWLTULQCNGMRW2VA5V X-MailFrom: h.laimer@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: The count lives in the per-process environment and is only reported by a forked task at its end. A warning logged while handling a plain API request stays counted, so every task the process forks afterwards ends with WARNINGS although nothing in its log warned. Signed-off-by: Hannes Laimer --- reproducer: run it against a running guest ``` curl -sk -H "$T" -X PUT https://localhost:8006/api2/json/nodes/$N/qemu/$V/config --data-urlencode "net9=model=e1000,bridge=vmbr0,mtu=1400" ``` potentially a few times with different nics, so every worker is getting the warning. Then just open a console, and close it again. The warning count is on the worker, so every task the worker spawns will inherit this count. ``` Sep 04 08:45:47 sdn1 pvedaemon[19533]: netdev net9: ignoring MTU '1400', not using VirtIO ``` is the warning the worker counted, and is in the syslog. src/PVE/RESTEnvironment.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PVE/RESTEnvironment.pm b/src/PVE/RESTEnvironment.pm index 81d7e29..7c75272 100644 --- a/src/PVE/RESTEnvironment.pm +++ b/src/PVE/RESTEnvironment.pm @@ -562,6 +562,9 @@ sub fork_worker { $0 = "task $upid"; $WORKER_FLAG = 1; + # the count is reported at the end of this task, warnings the parent logged while + # handling requests before the fork are not part of it + $self->{warning_count} = 0; $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub { die "received interrupt\n"; }; -- 2.47.3