feat: HAPROXY_NBTHREAD per-host thread-count knob (global nbthread, only when set)
HAProxy Manager Build and Push / Build-and-Push (push) Successful in 22m41s

2026-11-19 sdbees: with nbthread 4 a thread spun on a server lock held by a
TLS health-check thread stalled in a page fault under memory pressure ->
watchdog abort of the whole edge. nbthread 1 removes the failure class.

HAPROXY_NBTHREAD (container env, integer 1-64) renders `nbthread N` in the
global section ONLY when set. Unset/invalid = not rendered: every other host's
config is byte-identical to before (verified against main's template, with and
without Coraza). Invalid values are ignored with a warning, never rendered.

Tests: scripts/test-nbthread-knob.py (parse, render, unset byte-identity vs the
template minus the block, no cpu-map/thread-groups), run in the image build; real
haproxy -c of nbthread 1 (+SPOE+QUIC) and of a bad value in
validate-rendered-config.py. VERSION 2026.11.8 (with the arm64 base guard).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
This commit is contained in:
shadowdaoandClaude Sonnet 5.5 committed 2026-11-19 19:30:07 -08:00
1 parent 56404f4777
commit 8ab6fdcef0
7 files changed
+130 -2

No files matched your search

+13
View File
@@ -40,6 +40,19 @@ global
user haproxy
group haproxy
daemon
{%- if nbthread %}
# PER-HOST THREAD COUNT. Only emitted when HAPROXY_NBTHREAD is set on the
# container (WHP: /etc/whp/edge-nbthread -> container-manager.sh -> env),
# so a host that does not set it renders byte-identically to before and
# HAProxy keeps choosing automatically (all CPUs in its affinity mask).
# Why a host would set 1: 2026-11-19 sdbees, thread 1 spun on a server
# lock held by a TLS health-check thread stalled in a page fault under
# memory pressure -> watchdog abort (whole edge down). With one thread
# there is no other lock holder, so the failure class cannot occur.
# Do NOT combine with cpu-map/thread-groups here: neither is rendered.
nbthread {{ nbthread }}
{%- endif %}
# SSL and Performance
tune.ssl.default-dh-param 2048