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

+14 -1
View File
@@ -146,6 +146,17 @@ SCENARIOS = (
'HAPROXY_CORAZA_SPOE_BACKEND': '127.0.0.1:9000',
'HAPROXY_DEFAULT_SPLASH': 'off',
}),
# Per-host thread count knob: `nbthread 1` must parse next to everything
# else rendered (limited-quic, QUIC bind, SPOE, stats-file). A bad value
# must be IGNORED (not rendered), never reach haproxy.
('nbthread-1', {
'HAPROXY_SUSPENSION_ENABLED': 'true',
'HAPROXY_CORAZA_SPOE_BACKEND': '127.0.0.1:9000',
'HAPROXY_NBTHREAD': '1',
}),
('nbthread-bad', {
'HAPROXY_NBTHREAD': 'abc',
}),
)
@@ -308,7 +319,7 @@ def render(scenario_name, env_overrides, workdir):
saved_env = {}
for key in ('HAPROXY_SUSPENSION_ENABLED', 'HAPROXY_CORAZA_SPOE_BACKEND',
'HAPROXY_DEFAULT_SPLASH'):
'HAPROXY_DEFAULT_SPLASH', 'HAPROXY_NBTHREAD'):
saved_env[key] = os.environ.pop(key, None)
os.environ.update(env_overrides)
@@ -342,6 +353,8 @@ def assert_scenario_branches(scenario_name, config_path, env_overrides):
'HAPROXY_CORAZA_SPOE_BACKEND' in env_overrides),
'splash': ('file /haproxy/errors/default-splash.html',
env_overrides.get('HAPROXY_DEFAULT_SPLASH') != 'off'),
'nbthread': ('\n nbthread 1\n',
env_overrides.get('HAPROXY_NBTHREAD') == '1'),
}
for label, (needle, should_be_present) in expected.items():
present = needle in text