public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH pve-common] rest environment: start each worker task with a clean warning count
@ 2026-09-04  7:25 Hannes Laimer
  0 siblings, 0 replies; only message in thread
From: Hannes Laimer @ 2026-09-04  7:25 UTC (permalink / raw)
  To: pve-devel

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 <h.laimer@proxmox.com>
---
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





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-04  7:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-04  7:25 [PATCH pve-common] rest environment: start each worker task with a clean warning count Hannes Laimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal