BUG/MEDIUM: stats: fix crash on 'dump stats-file'
Some checks failed
Contrib / admin/halog/ (push) Has been cancelled
Contrib / dev/flags/ (push) Has been cancelled
Contrib / dev/haring/ (push) Has been cancelled
Contrib / dev/hpack/ (push) Has been cancelled
Contrib / dev/poll/ (push) Has been cancelled
VTest / Generate Build Matrix (push) Has been cancelled
Windows / Windows, gcc, all features (push) Has been cancelled
VTest / (push) Has been cancelled

A crash occurs immediately when stats-file dump is requested by the
command-line. The issue is caused by the introduction of watchers when
iterating over the proxies list, which is now required with dynamic
backends.

  commit 20376c54e2
  MINOR: stats: protect proxy iteration via watcher

The above patch initializes the new proxy watcher for stats dump and
HTML. However, this was forgotten for stats-file command context. Fix
this by adding the missing watcher_init() in cli_parse_show_stat().

No need to backport.
This commit is contained in:
Amaury Denoyelle 2026-04-24 15:58:42 +02:00
parent 85c3f3c1fd
commit 352db46b08

View file

@ -1057,6 +1057,7 @@ static int cli_parse_dump_stat_file(char **args, char *payload,
ctx->domain = STATS_DOMAIN_PROXY;
ctx->flags |= STAT_F_FMT_FILE;
watcher_init(&ctx->srv_watch, &ctx->obj2, offsetof(struct server, watcher_list));
watcher_init(&ctx->px_watch, &ctx->obj1, offsetof(struct proxy, watcher_list));
return 0;
}