summaryrefslogtreecommitdiffstats
path: root/modules/core
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2020-04-17 19:15:51 +0200
committerYann Ylavic <ylavic@apache.org>2020-04-17 19:15:51 +0200
commit8f5905c058ad6603282575e9377d0eea4f8b7c35 (patch)
tree198f4a0f51648674aab633e07b7369dc9918335a /modules/core
parentcore, h2: common ap_parse_request_line() and ap_check_request_header() code. (diff)
downloadapache2-8f5905c058ad6603282575e9377d0eea4f8b7c35.tar.xz
apache2-8f5905c058ad6603282575e9377d0eea4f8b7c35.zip
mod_watchdog: use a single "wd_running" pool in wd_worker() thread.
Clear the pool where appropriate instead of multiple create/destroy. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876675 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/core')
-rw-r--r--modules/core/mod_watchdog.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/modules/core/mod_watchdog.c b/modules/core/mod_watchdog.c
index 1723eeec51..e7e05287a0 100644
--- a/modules/core/mod_watchdog.c
+++ b/modules/core/mod_watchdog.c
@@ -159,6 +159,10 @@ static void* APR_THREAD_FUNC wd_worker(apr_thread_t *thread, void *data)
apr_sleep(AP_WD_TM_SLICE);
}
}
+
+ apr_pool_create(&temp_pool, w->pool);
+ apr_pool_tag(temp_pool, "wd_running");
+
if (w->is_running) {
watchdog_list_t *wl = w->callbacks;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, wd_server_conf->s,
@@ -166,16 +170,13 @@ 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(&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, temp_pool);
wl = wl->next;
}
- apr_pool_destroy(temp_pool);
- temp_pool = NULL;
+ apr_pool_clear(temp_pool);
}
else {
ap_run_watchdog_init(wd_server_conf->s, w->name, w->pool);
@@ -203,10 +204,6 @@ 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 (!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,
@@ -227,23 +224,17 @@ 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 (!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, temp_pool);
}
}
- if (temp_pool) {
- apr_pool_destroy(temp_pool);
- temp_pool = NULL;
- }
- if (!w->is_running) {
- break;
- }
+
+ apr_pool_clear(temp_pool);
}
+
+ apr_pool_destroy(temp_pool);
+
if (inited) {
/* Run the watchdog exit hooks.
* If this was singleton watchdog the init hook