]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* mod_http2: fix version suffix after sync with github
authorStefan Eissing <icing@apache.org>
Thu, 23 Sep 2021 13:44:58 +0000 (13:44 +0000)
committerStefan Eissing <icing@apache.org>
Thu, 23 Sep 2021 13:44:58 +0000 (13:44 +0000)
    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

modules/http2/h2_version.h
modules/http2/h2_workers.c

index 7fea6d974bd96f2e7628c3c7276319aeec0b1ce9..40f40a2aa5c77bad9c6a43c4386950e1f30aef90 100644 (file)
@@ -27,7 +27,7 @@
  * @macro
  * Version number of the http2 module as c string
  */
-#define MOD_HTTP2_VERSION "1.15.24-git"
+#define MOD_HTTP2_VERSION "1.15.24"
 
 /**
  * @macro
index ceed4c6d5e18f9c2ce28f41f6ac9e9582636c869..9657ec12896c4cb7d9a040e0b0d969587d12400c 100644 (file)
@@ -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,