]> git.kaiwu.me - haproxy.git/commit
MINOR: mworker: assign a unique ID to the master process
authorWilly Tarreau <w@1wt.eu>
Tue, 15 Sep 2026 11:45:35 +0000 (13:45 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Sep 2026 16:00:51 +0000 (18:00 +0200)
commitfbe37fa504b54f1bda9a05bf022c102b74244aab
tree9c85b1581c67f47911d355f3423dac8824d5fa34
parentd3adda53a784033fef613201dab2f7d98504b862
MINOR: mworker: assign a unique ID to the master process

The master process now has a unique identifier, either generated at boot
as a time-ordered UUID (version 7), or inherited from the
HAPROXY_MASTER_ID environment variable when a valid one is already set
there (inherited from a previous master instance). An invalid value is
simply replaced by a generated one, since there is generally nothing the
user can do about it. The identifier is exported to the environment so
that it is both preserved by the next master upon reload (re-exec) and
visible from the worker, where it may be referenced as
"$HAPROXY_MASTER_ID" from the configuration.

The format is validated using guid_is_valid_fmt() so that it is exactly
the same as the one of the proxies' and servers' "guid": at most 127
characters among letters, digits, '.', ':', '-' and '_'.

Note that both mworker_reexec() and the worker restore their initial
environment before going further, so the variable has to be set again
after that point, hence the two extra setenv() calls, just like for a
few other such variables.
doc/configuration.txt
include/haproxy/global-t.h
src/haproxy.c
src/mworker.c