]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: tools: use only opportunistic symbols resolution
authorWilly Tarreau <w@1wt.eu>
Fri, 21 Feb 2025 14:01:13 +0000 (15:01 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 21 Feb 2025 17:26:29 +0000 (18:26 +0100)
commiteb41d768f954d5c7360fd19ec69f9d707b900532
treeb84b413505918df25ec26dbbb6b84637dd22294b
parent3c22fa315bcb2945d588cb64302f6ba5c89b382e
MINOR: tools: use only opportunistic symbols resolution

As seen in issue #2861, dladdr_and_size() an be quite expensive and
will often hold a mutex in the underlying library. It becomes a real
problem when issuing lots of "show threads" or wdt warnings in parallel
because threads will queue up waiting for each other to finish, adding
to their existing latency that possibly caused the warning in the first
place.

Here we're taking a different approach. If the thread is not isolated
and not panicking, it's doing unimportant stuff like showing threads
or warnings. In this case we try to grab a lock, and if we fail because
another thread is already there, we just pretend we cannot resolve the
symbol. This is not critical because then we fall back to the already
used case which consists in writing "main+<offset>". In practice this
will almost never happen except in bad situations which could have
otherwise degenerated.
src/tools.c