project-pegaprox icon indicating copy to clipboard operation
project-pegaprox copied to clipboard

[Bug] SMBIOS auto-config daemon emits constant journal spam in steady state ("already has SMBIOS configuration" every cycle)

Open daglimmer opened this issue 2 months ago • 3 comments

What happens

The daemon deployed from SMBIOS_SCRIPT_TEMPLATE (pegaprox/api/nodes.py) logs VM <id> already has SMBIOS configuration on every poll cycle for every already-configured VM.

On a production 9-PVE-host fleet this measured ~2 log lines/sec/node (~35k lines/day fleet-wide on 2026-10-03) — journald carries a steady noise floor where real state changes (new VM, re-created VM, errors) are buried.

Root cause (two parts, both in the template)

  1. needs_smbios_update() logs inside the predicate (the "already has SMBIOS configuration" line) — the log fires while evaluating the check, regardless of the boolean result.
  2. The main loop's recreate-check calls that predicate for every processed VM on every 30s cycle, so every configured VM produces the line once per cycle, forever.

Secondary: log_message() stdout is block-buffered under systemd, masking up to ~13 minutes of lines during incident triage.

Minimal repro (no Proxmox needed)

Render the template exactly like the deploy endpoint (AST-extract value, .format() on the 4 deploy keys, write to a real .py, import, run main() against a tmpdir conf tree). 3 cycles × 3 VMs (new-unstamped / pre-stamped / pending-only, plus a same-ID recreate at cycle 1):

spam lines
unpatched current Testing 10 (grows every cycle)
with fix 0

set_smbios invocations are identical (exactly 2) before and after — only the logging changes.

Proposed fix

  • Remove the log side-effect from needs_smbios_update() (silent steady state).
  • Restructure the main loop: conf-exists gate first; processed-set membership short-circuits the whole re-check chain; log only on state change.
  • Line-buffered stdout (print(..., flush=True)).

PR follows.

daglimmer avatar Oct 03 '26 11:10 daglimmer

👋 Thanks for opening an issue!

It looks like the issue template was removed (or this was opened outside the templates). We rely on the Bug / Feature template so we can actually act on reports — a description-only issue with the template deleted almost always misses the details we need (version, repro, environment).

Please open a fresh issue using one of the templates (New issue → 🐛 Bug Report or ✨ Feature Request) and fill in the sections. 🐾

This is an automated message — closing for now; reopen with a completed template.

github-actions[bot] avatar Oct 03 '26 11:10 github-actions[bot]

Sorry, our template bot was a bit too eager on this one, reopened it.

Checked it against Testing and you are right: the "already has SMBIOS configuration" line comes from the recreate check, which runs needs_smbios_update() for every processed VM on every cycle, so it never stops. Thanks for the write-up and for #970, I will go through it.

Marcus

mkellermann97 avatar Oct 04 '26 07:10 mkellermann97

Fixed on Testing with fa5a77a, comes with the next release.

mkellermann97 avatar Oct 04 '26 08:10 mkellermann97