From: Willy Tarreau Date: Fri, 25 Sep 2026 08:17:21 +0000 (+0200) Subject: MINOR: init: also set the worker-id in file-less mode X-Git-Tag: v3.5-dev8~113 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=0ceb8c65fc28b8db060a6a3f96cfc127a3a4b2f6;p=haproxy.git MINOR: init: also set the worker-id in file-less mode The worker-id generation at boot, as done in commit 3639aac31f ("MINOR: config: add a "worker-id" global keyword to identify the worker"), would escape the file-less mode that is used with haterm and haload. There's nothing dramatic in this, but it may end up being surprising with certain corner-case configs that would want to exploit it (logging, header contents etc), so better set it now for consistency between any worker mode. It was visible by running haterm: $ ./haterm -L :8000 -G "stats socket /tmp/sock1 level admin" and issuing: $ socat - /tmp/sock1 <<< "show info" which didn't show the Worker_id line before the fix. No backport is needed. --- diff --git a/src/haproxy.c b/src/haproxy.c index 317855bd9..e965aa584 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2218,6 +2218,12 @@ static void step_init_2(int argc, char** argv) } last_defproxy = NULL; /* This variable is not used after parsing. */ + /* In fileless mode (haterm, haload, ...) it's the only place where + * we'll be able to initialize the worker id. + */ + if (!master) + init_worker_id(); + if (global.tune.options & GTUNE_PURGE_DEFAULTS) { /* destroy unreferenced defaults proxies */ defaults_px_destroy_all_unref();