]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: stats: Make stat_l variable used to dump a stat line thread local
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 6 Jan 2021 06:41:56 +0000 (07:41 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 6 Jan 2021 09:34:12 +0000 (10:34 +0100)
commitde79cd28ec9e1facc5f2da02cd95dda82ac6fe58
tree736c5816c4f28245c17423956f948fb4258d077f
parentfae9a4cd2c09e031b274a541edb872328d596700
BUG/MINOR: stats: Make stat_l variable used to dump a stat line thread local

Since ee63d4bd6 ("MEDIUM: stats: integrate static proxies stats in new
stats"), all dumped stats for a given domain, the default ones and the
modules ones, are merged in a signle array to dump them in a generic way.
For this purpose, the stat_l global variable is allocated at startup to
store a line of stats before the dump, i.e. all stats of an entity
(frontend, backend, listener, server or dns nameserver). But this variable
is not thread safe.  If stats are retrieved concurrently by several clients
on different threads, the same variable is used. This leads to corrupted
stats output.

To fix the bug, the stat_l variable is now thread local.

This patch should probably solve issues #972 and #992. It must be backported
to 2.3.
src/stats.c