]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cli: properly decrement ref count on tables during failed dumps
authorWilly Tarreau <w@1wt.eu>
Fri, 18 Nov 2016 18:17:40 +0000 (19:17 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 18 Nov 2016 18:20:09 +0000 (19:20 +0100)
Gernot Pörner reported some constant leak of ref counts for stick tables
entries. It happens that this leak was not at all in the regular traffic
path but on the "show table" path. An extra ref count was taken during
the dump if the output had to be paused, and it was released upon clean
termination or an error detected in the I/O handler. But the release
handler didn't do it, while it used to properly do it for the sessions
dump.

This fix needs to be backported to 1.6.

src/dumpstats.c

index 4c3f8302738ecc98b6eec0f7202117d8e404e5b5..e9ae9e885a7e9bdc2c8118fe313d5487bf3216af 100644 (file)
@@ -6770,6 +6770,11 @@ static void cli_release_handler(struct appctx *appctx)
                if (!LIST_ISEMPTY(&appctx->ctx.sess.bref.users))
                        LIST_DEL(&appctx->ctx.sess.bref.users);
        }
+       else if ((appctx->st0 == STAT_CLI_O_TAB || appctx->st0 == STAT_CLI_O_CLR) &&
+                appctx->st2 == STAT_ST_LIST) {
+               appctx->ctx.table.entry->ref_cnt--;
+               stksess_kill_if_expired(&appctx->ctx.table.proxy->table, appctx->ctx.table.entry);
+       }
        else if (appctx->st0 == STAT_CLI_PRINT_FREE) {
                free(appctx->ctx.cli.err);
                appctx->ctx.cli.err = NULL;