]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MEDIUM: proxy: fix stick table expired entries cleanup on stopping
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 2 Nov 2026 13:34:42 +0000 (14:34 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 2 Nov 2026 13:58:15 +0000 (14:58 +0100)
Since the following patch, proxy internal management task is only
created for frontends or if a stick-table is present. This notably
serves to purge expired entries from tables on soft-stop.

  a4a17eb36698c927de1c3171236fcc5a6997721a
  OPTIM/MINOR: proxy: do not init proxy management task if unused

However, the condition was incorrectly written, as it is never true for
the stick-table case. This is because table's <current> member is always
zero at parse time as the stick-table is still empty. Thus, the task is
not allocated for backends even if stick-table is declared. This results
in worker processes potentially leaving expired entries in stick-tables.

The error originates from reusing the condition from manage_proxy(),
which performs the stick-table cleanup. In this context it makes sense
to check <current> value.

Fix the condition to ensure the task is allocated when a stick-table is
declared. Checking the proxy's <table> member is sufficient for that.

This fixes github issue #3554.

This must be backported up to 3.4.

src/cfgparse.c

index 3459d55c27aa983a3be02433af1c5950ac23df7a..e6667cbd7144f29806a02edb8863e0d119ef9f53 100644 (file)
@@ -2630,7 +2630,7 @@ init_proxies_list_stage2:
                /* Create the task associated with the proxy. Only necessary
                 * for frontend or if a stick-table is defined.
                 */
-               if ((curproxy->cap & PR_CAP_FE) || (curproxy->table && curproxy->table->current)) {
+               if ((curproxy->cap & PR_CAP_FE) || curproxy->table) {
                        curproxy->task = task_new_anywhere();
                        if (curproxy->task) {
                                curproxy->task->context = curproxy;