From f2c75343da61cde8e985bb623155514ef0938bd1 Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Sat, 23 Jan 2016 03:53:45 +0000 Subject: [PATCH] Use a shorter-lived pool to conserve mem. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1726351 13f79535-47bb-0310-9956-ffa450edef68 --- modules/proxy/mod_proxy_hcheck.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/proxy/mod_proxy_hcheck.c b/modules/proxy/mod_proxy_hcheck.c index d9a17a887e..2a01d85aab 100644 --- a/modules/proxy/mod_proxy_hcheck.c +++ b/modules/proxy/mod_proxy_hcheck.c @@ -68,6 +68,7 @@ typedef struct { } wctx_t; typedef struct { + apr_pool_t *ptemp; sctx_t *ctx; proxy_worker *worker; apr_time_t now; @@ -766,10 +767,9 @@ static void *hc_check(apr_thread_t *thread, void *b) sctx_t *ctx = baton->ctx; apr_time_t now = baton->now; proxy_worker *worker = baton->worker; + apr_pool_t *ptemp = baton->ptemp; server_rec *s = ctx->s; apr_status_t rv; - apr_pool_t *ptemp; - apr_pool_create(&ptemp, ctx->p); ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(03256) "%sHealth checking %s", (thread ? "Threaded " : ""), worker->s->name); @@ -876,13 +876,18 @@ static apr_status_t hc_watchdog_callback(int state, void *data, worker->s->name, worker->s->method, worker); if ((worker->s->method != NONE) && (now > worker->s->updated + worker->s->interval)) { baton_t *baton; + /* This pool must last the lifetime of the (possible) thread */ + apr_pool_t *ptemp; + apr_pool_create(&ptemp, ctx->p); + if ((rv = hc_init_worker(ctx, worker)) != APR_SUCCESS) { return rv; } - baton = apr_palloc(ctx->p, sizeof(baton_t)); + baton = apr_palloc(ptemp, sizeof(baton_t)); baton->ctx = ctx; baton->now = now; baton->worker = worker; + baton->ptemp = ptemp; if (ctx->hctp) { #if HC_USE_THREADS -- 2.40.0