From 0ceb8c65fc28b8db060a6a3f96cfc127a3a4b2f6 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 25 Sep 2026 10:17:21 +0200 Subject: [PATCH] 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. --- src/haproxy.c | 6 ++++++ 1 file changed, 6 insertions(+) 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(); -- 2.47.3