mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 05:11:26 +02:00
MINOR: pools: Don't dump anymore info about pools when purge is forced
Historically, when the purge of pools was forced by sending a SIGQUIT to haproxy, information about the pools were first dumped. It is now totally pointless because these info can be retrieved via the CLI. It is even less relevant now because the purge is forced typically when there are memroy issues and to dump pools information, data must be allocated. dump_pools_info() function was simplified because it is now called only from an applet. No reason to still try to dump info on stderr.
This commit is contained in:
parent
982805e6a3
commit
e653dc304e
@ -900,9 +900,7 @@ If a memory allocation fails due to the memory limit being reached or because
|
|||||||
the system doesn't have any enough memory, then haproxy will first start to
|
the system doesn't have any enough memory, then haproxy will first start to
|
||||||
free all available objects from all pools before attempting to allocate memory
|
free all available objects from all pools before attempting to allocate memory
|
||||||
again. This mechanism of releasing unused memory can be triggered by sending
|
again. This mechanism of releasing unused memory can be triggered by sending
|
||||||
the signal SIGQUIT to the haproxy process. When doing so, the pools state prior
|
the signal SIGQUIT to the haproxy process.
|
||||||
to the flush will also be reported to stderr when the process runs in
|
|
||||||
foreground.
|
|
||||||
|
|
||||||
During a reload operation, the process switched to the graceful stop state also
|
During a reload operation, the process switched to the graceful stop state also
|
||||||
automatically performs some flushes after releasing any connection so that all
|
automatically performs some flushes after releasing any connection so that all
|
||||||
|
@ -177,7 +177,6 @@ void *pool_get_from_os_noinc(struct pool_head *pool);
|
|||||||
void pool_put_to_os_nodec(struct pool_head *pool, void *ptr);
|
void pool_put_to_os_nodec(struct pool_head *pool, void *ptr);
|
||||||
void *pool_alloc_nocache(struct pool_head *pool, const void *caller);
|
void *pool_alloc_nocache(struct pool_head *pool, const void *caller);
|
||||||
void pool_free_nocache(struct pool_head *pool, void *ptr);
|
void pool_free_nocache(struct pool_head *pool, void *ptr);
|
||||||
void dump_pools(void);
|
|
||||||
int pool_parse_debugging(const char *str, char **err);
|
int pool_parse_debugging(const char *str, char **err);
|
||||||
int pool_total_failures(void);
|
int pool_total_failures(void);
|
||||||
unsigned long long pool_total_allocated(void);
|
unsigned long long pool_total_allocated(void);
|
||||||
|
@ -895,8 +895,7 @@ static void sig_dump_state(struct sig_handler *sh)
|
|||||||
|
|
||||||
static void dump(struct sig_handler *sh)
|
static void dump(struct sig_handler *sh)
|
||||||
{
|
{
|
||||||
/* dump memory usage then free everything possible */
|
/* free everything possible */
|
||||||
dump_pools();
|
|
||||||
pool_gc(NULL);
|
pool_gc(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
35
src/pool.c
35
src/pool.c
@ -1348,11 +1348,11 @@ static int get_show_pools_info(struct show_pools_ctx *ctx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function dumps information about pools found in the context <ctx>. If
|
/* This function dumps information about pools found in the applet context.
|
||||||
* <appctx> is NULL, it dumps it on stderr. Otherwise the applet is used.
|
|
||||||
*/
|
*/
|
||||||
int dump_pools_info(struct appctx *appctx, struct show_pools_ctx *ctx)
|
int dump_pools_info(struct appctx *appctx)
|
||||||
{
|
{
|
||||||
|
struct show_pools_ctx *ctx = appctx->svcctx;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (ctx->pool_idx == -1) {
|
if (ctx->pool_idx == -1) {
|
||||||
@ -1361,9 +1361,7 @@ int dump_pools_info(struct appctx *appctx, struct show_pools_ctx *ctx)
|
|||||||
chunk_appendf(&trash, " (limited to the first %u entries)", ctx->maxcnt);
|
chunk_appendf(&trash, " (limited to the first %u entries)", ctx->maxcnt);
|
||||||
chunk_appendf(&trash, ". Use SIGQUIT to flush them.\n");
|
chunk_appendf(&trash, ". Use SIGQUIT to flush them.\n");
|
||||||
|
|
||||||
if (!appctx)
|
if (applet_putchk(appctx, &trash) == -1)
|
||||||
qfprintf(stderr, "%s", trash.area);
|
|
||||||
else if (applet_putchk(appctx, &trash) == -1)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ctx->pool_idx = 0;
|
ctx->pool_idx = 0;
|
||||||
@ -1391,9 +1389,7 @@ int dump_pools_info(struct appctx *appctx, struct show_pools_ctx *ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!appctx)
|
if (applet_putchk(appctx, &trash) == -1) {
|
||||||
qfprintf(stderr, "%s", trash.area);
|
|
||||||
else if (applet_putchk(appctx, &trash) == -1) {
|
|
||||||
ctx->pool_idx = i;
|
ctx->pool_idx = i;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1404,27 +1400,12 @@ int dump_pools_info(struct appctx *appctx, struct show_pools_ctx *ctx)
|
|||||||
".\n",
|
".\n",
|
||||||
ctx->nbpools, ctx->allocated, ctx->used, ctx->cached_bytes
|
ctx->nbpools, ctx->allocated, ctx->used, ctx->cached_bytes
|
||||||
);
|
);
|
||||||
if (!appctx)
|
if (applet_putchk(appctx, &trash) == -1)
|
||||||
qfprintf(stderr, "%s", trash.area);
|
|
||||||
else if (applet_putchk(appctx, &trash) == -1)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump statistics on pools usage. */
|
|
||||||
void dump_pools(void)
|
|
||||||
{
|
|
||||||
struct show_pools_ctx ctx;
|
|
||||||
|
|
||||||
memset(&ctx, 0, sizeof(ctx));
|
|
||||||
|
|
||||||
if (get_show_pools_info(&ctx) == -1) {
|
|
||||||
qfprintf(stderr, "Failed to get info about pools.\n");
|
|
||||||
}
|
|
||||||
dump_pools_info(NULL, &ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function returns the total number of failed pool allocations */
|
/* This function returns the total number of failed pool allocations */
|
||||||
int pool_total_failures()
|
int pool_total_failures()
|
||||||
{
|
{
|
||||||
@ -1613,9 +1594,7 @@ static void cli_release_show_pools(struct appctx *appctx)
|
|||||||
*/
|
*/
|
||||||
static int cli_io_handler_dump_pools(struct appctx *appctx)
|
static int cli_io_handler_dump_pools(struct appctx *appctx)
|
||||||
{
|
{
|
||||||
struct show_pools_ctx *ctx = appctx->svcctx;
|
return dump_pools_info(appctx);
|
||||||
|
|
||||||
return dump_pools_info(appctx, ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* callback used to create early pool <name> of size <size> and store the
|
/* callback used to create early pool <name> of size <size> and store the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user