]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: stick-tables: give up on lock contention in process_table_expire()
authorWilly Tarreau <w@1wt.eu>
Tue, 9 Sep 2025 13:03:52 +0000 (15:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 9 Sep 2025 15:56:37 +0000 (17:56 +0200)
commita771b14541528a96060d1b711fcd7c94e9f0cfbf
treeef62b047d74d88d43e30b49c67f5069f1af75618
parentf87cf8b76eb2ecb59b856252888751052a177ce5
MEDIUM: stick-tables: give up on lock contention in process_table_expire()

process_table_expire() can take quite a lot of time running over all
shards. During this time it will hinder track-sc rules and peers, which
will experience an increased latency to do their work, especially peers
where each message will cause a lock, whose cumulated time can exceed
the watchdog's patience.

Here, we proceed just like in stktable_trash_oldest(), which is that
we're using a trylock to detect contention. The first time it happens,
if we hadn't purged anything, we switch to a regular lock to perform
the operation, and next time it happens we abort. This guarantees that
some entries will be expired and that contention will be reduced with
when detected.

With this change, various tests didn't manage to produce any warning,
including at the end of the load generation session.

This should be backported to 3.2 after a bit more testing.
src/stick_table.c