From: Willy Tarreau Date: Wed, 30 Sep 2026 09:19:05 +0000 (+0200) Subject: BUG/MINOR: stick-table: do not count the lookup itself in table_trackers() X-Git-Tag: v3.5-dev8~82 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=e32245e6282ba5c49adb9ee5f7d1376979fa3992;p=haproxy.git BUG/MINOR: stick-table: do not count the lookup itself in table_trackers() In 1.8 when adding multi-threading support with commit 819fc6f563 ("MEDIUM: threads/stick-tables: handle multithreads on stick tables"), the entry's ref_cnt was incremented by one on all trackers and accesses, and smp_fetch_sc_trackers() learned to return one less than the visible value so as not to count itself in it. One of them was missed: table_trackers() returns the number of trackers without subtracting one so it's always one above the real value. Let's adjust it like other places do. This can be backported to all versions. --- diff --git a/src/stick_table.c b/src/stick_table.c index ca44cb430..9c447bb99 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -2710,7 +2710,7 @@ static int sample_conv_table_trackers(const struct arg *arg_p, struct sample *sm if (!ts) return 1; - smp->data.u.sint = HA_ATOMIC_LOAD(&ts->ref_cnt); + smp->data.u.sint = HA_ATOMIC_LOAD(&ts->ref_cnt) - 1; // don't count ourselves stktable_release(t, ts); return 1;