summaryrefslogtreecommitdiff
path: root/modules/core
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2020-04-16 17:55:48 +0000
committerJoe Orton <jorton@apache.org>2020-04-16 17:55:48 +0000
commit9e6be7306586e58813a3717d48bec60113571546 (patch)
tree7326ba13b17a83d3f33b710e01be7e0718130d60 /modules/core
parent73376148af245b520f12fdf119da8caa2154e2f3 (diff)
downloadhttpd-9e6be7306586e58813a3717d48bec60113571546.tar.gz
* modules/core/mod_watchdog.c (wd_worker): Fix crashes snuck into
r1876599 where a destroyed pool was reused. Rename the "ctx" variable to reflect its purpose. Also tweak the pool tags. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876619 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/core')
-rw-r--r--modules/core/mod_watchdog.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/modules/core/mod_watchdog.c b/modules/core/mod_watchdog.c
index d833939cb0..1723eeec51 100644
--- a/modules/core/mod_watchdog.c
+++ b/modules/core/mod_watchdog.c
@@ -112,7 +112,7 @@ static void* APR_THREAD_FUNC wd_worker(apr_thread_t *thread, void *data)
int probed = 0;
int inited = 0;
int mpmq_s = 0;
- apr_pool_t *ctx = NULL;
+ apr_pool_t *temp_pool = NULL;
w->pool = apr_thread_pool_get(thread);
w->is_running = 1;
@@ -166,15 +166,16 @@ static void* APR_THREAD_FUNC wd_worker(apr_thread_t *thread, void *data)
w->singleton ? "Singleton " : "", w->name);
apr_time_clock_hires(w->pool);
if (wl) {
- apr_pool_create(&ctx, w->pool);
- apr_pool_tag(ctx, "wd_running");
+ apr_pool_create(&temp_pool, w->pool);
+ apr_pool_tag(temp_pool, "wd_running-singleton");
while (wl && w->is_running) {
/* Execute watchdog callback */
wl->status = (*wl->callback_fn)(AP_WATCHDOG_STATE_STARTING,
- (void *)wl->data, ctx);
+ (void *)wl->data, temp_pool);
wl = wl->next;
}
- apr_pool_destroy(ctx);
+ apr_pool_destroy(temp_pool);
+ temp_pool = NULL;
}
else {
ap_run_watchdog_init(wd_server_conf->s, w->name, w->pool);
@@ -202,14 +203,14 @@ static void* APR_THREAD_FUNC wd_worker(apr_thread_t *thread, void *data)
if (wl->status == APR_SUCCESS) {
wl->step += (apr_time_now() - curr);
if (wl->step >= wl->interval) {
- if (!ctx) {
- apr_pool_create(&ctx, w->pool);
- apr_pool_tag(ctx, "wd_running");
+ if (!temp_pool) {
+ apr_pool_create(&temp_pool, w->pool);
+ apr_pool_tag(temp_pool, "wd_running-callback");
}
wl->step = 0;
/* Execute watchdog callback */
wl->status = (*wl->callback_fn)(AP_WATCHDOG_STATE_RUNNING,
- (void *)wl->data, ctx);
+ (void *)wl->data, temp_pool);
if (ap_mpm_query(AP_MPMQ_MPM_STATE, &mpmq_s) != APR_SUCCESS) {
w->is_running = 0;
}
@@ -226,17 +227,19 @@ static void* APR_THREAD_FUNC wd_worker(apr_thread_t *thread, void *data)
*/
w->step += (apr_time_now() - curr);
if (w->step >= wd_interval) {
- if (!ctx) {
- apr_pool_create(&ctx, w->pool);
- apr_pool_tag(ctx, "wd_running");
+ if (!temp_pool) {
+ apr_pool_create(&temp_pool, w->pool);
+ apr_pool_tag(temp_pool, "wd_running");
}
w->step = 0;
/* Run watchdog step hook */
- ap_run_watchdog_step(wd_server_conf->s, w->name, ctx);
+ ap_run_watchdog_step(wd_server_conf->s, w->name, temp_pool);
}
}
- if (ctx)
- apr_pool_destroy(ctx);
+ if (temp_pool) {
+ apr_pool_destroy(temp_pool);
+ temp_pool = NULL;
+ }
if (!w->is_running) {
break;
}