summaryrefslogtreecommitdiffstats
path: root/modules/http2/h2_workers.c
diff options
context:
space:
mode:
authorStefan Eissing <icing@apache.org>2021-09-23 15:44:58 +0200
committerStefan Eissing <icing@apache.org>2021-09-23 15:44:58 +0200
commitebf7cf2faf3f312b481d47414016cb85d476201d (patch)
tree401d4bd9fbc5d2a299171f1c77eea2e2fdfe88f7 /modules/http2/h2_workers.c
parent* t/modules/http2.t is gone since 1893547. So do not use it any longer in (diff)
downloadapache2-ebf7cf2faf3f312b481d47414016cb85d476201d.tar.xz
apache2-ebf7cf2faf3f312b481d47414016cb85d476201d.zip
* mod_http2: fix version suffix after sync with github
Make shutdown worker wait loop robust against timed wait interruptions and report the correct seconds waited. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893563 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/http2/h2_workers.c')
-rw-r--r--modules/http2/h2_workers.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/modules/http2/h2_workers.c b/modules/http2/h2_workers.c
index ceed4c6d5e..9657ec1289 100644
--- a/modules/http2/h2_workers.c
+++ b/modules/http2/h2_workers.c
@@ -319,9 +319,9 @@ static void workers_abort_idle(h2_workers *workers)
static apr_status_t workers_pool_cleanup(void *data)
{
h2_workers *workers = data;
- apr_time_t timout = apr_time_from_sec(1);
+ apr_time_t end, timout = apr_time_from_sec(1);
apr_status_t rv;
- int i, n = 5;
+ int n, wait_sec = 5;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, workers->s,
"h2_workers: cleanup %d workers idling",
@@ -333,10 +333,9 @@ static apr_status_t workers_pool_cleanup(void *data)
* have either been handled (graceful) or we are forced exiting
* (ungrateful). Either way, we show limited patience. */
apr_thread_mutex_lock(workers->lock);
- for (i = 0; i < n; ++i) {
- if (!apr_atomic_read32(&workers->worker_count)) {
- break;
- }
+ end = apr_time_now() + apr_time_from_sec(wait_sec);
+ while ((n = apr_atomic_read32(&workers->worker_count)) > 0
+ && apr_time_now() < end) {
rv = apr_thread_cond_timedwait(workers->all_done, workers->lock, timout);
if (APR_TIMEUP == rv) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, workers->s,
@@ -346,11 +345,11 @@ static apr_status_t workers_pool_cleanup(void *data)
continue;
}
}
- if (i >= n) {
+ if (n) {
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, workers->s,
APLOGNO(10291) "h2_workers: cleanup, %d idle workers "
"did not exit after %d seconds.",
- apr_atomic_read32(&workers->worker_count), i);
+ n, wait_sec);
}
apr_thread_mutex_unlock(workers->lock);
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, workers->s,