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
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
-to the flush will also be reported to stderr when the process runs in
-foreground.
+the signal SIGQUIT to the haproxy process.
During a reload operation, the process switched to the graceful stop state also
automatically performs some flushes after releasing any connection so that all
return 0;
}
-/* This function dumps information about pools found in the context <ctx>. If
- * <appctx> is NULL, it dumps it on stderr. Otherwise the applet is used.
+/* This function dumps information about pools found in the applet context.
*/
-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;
if (ctx->pool_idx == -1) {
chunk_appendf(&trash, " (limited to the first %u entries)", ctx->maxcnt);
chunk_appendf(&trash, ". Use SIGQUIT to flush them.\n");
- if (!appctx)
- qfprintf(stderr, "%s", trash.area);
- else if (applet_putchk(appctx, &trash) == -1)
+ if (applet_putchk(appctx, &trash) == -1)
return 0;
ctx->pool_idx = 0;
}
}
- if (!appctx)
- qfprintf(stderr, "%s", trash.area);
- else if (applet_putchk(appctx, &trash) == -1) {
+ if (applet_putchk(appctx, &trash) == -1) {
ctx->pool_idx = i;
return 0;
}
".\n",
ctx->nbpools, ctx->allocated, ctx->used, ctx->cached_bytes
);
- if (!appctx)
- qfprintf(stderr, "%s", trash.area);
- else if (applet_putchk(appctx, &trash) == -1)
+ if (applet_putchk(appctx, &trash) == -1)
return 0;
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 */
int pool_total_failures()
{
*/
static int cli_io_handler_dump_pools(struct appctx *appctx)
{
- struct show_pools_ctx *ctx = appctx->svcctx;
-
- return dump_pools_info(appctx, ctx);
+ return dump_pools_info(appctx);
}
/* callback used to create early pool <name> of size <size> and store the