* [PATCH pve-common] rest environment: start each worker task with a clean warning count
@ 2026-09-04 7:25 Hannes Laimer
2026-10-20 7:38 ` Hannes Laimer
0 siblings, 1 reply; 2+ messages 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] 2+ messages in thread
* Re: [PATCH pve-common] rest environment: start each worker task with a clean warning count
2026-09-04 7:25 [PATCH pve-common] rest environment: start each worker task with a clean warning count Hannes Laimer
@ 2026-10-20 7:38 ` Hannes Laimer
0 siblings, 0 replies; 2+ messages in thread
From: Hannes Laimer @ 2026-10-20 7:38 UTC (permalink / raw)
To: pve-devel
gentle ping, still applies :)
On 2026-09-04 09:25, Hannes Laimer wrote:
> 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"; };
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-20 7:38 UTC | newest]
Thread overview: 2+ messages (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
2026-10-20 7:38 ` Hannes Laimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox