]> granicus.if.org Git - apache/commitdiff
core: follow up to r1629909: fix min_spare_threads lower bound and check wrt num_buckets.
authorYann Ylavic <ylavic@apache.org>
Tue, 7 Oct 2014 21:59:02 +0000 (21:59 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 7 Oct 2014 21:59:02 +0000 (21:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629990 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/event/event.c
server/mpm/eventopt/eventopt.c
server/mpm/worker/worker.c

index 436eff0f1210cc878356a2dad88021a1ff877e9f..2e9615ecc48d76102e113be22dea5a4abaaa0d30 100644 (file)
@@ -2809,7 +2809,7 @@ static void perform_idle_server_maintenance(int child_bucket)
         ap_mpm_podx_signal(pod[child_bucket], AP_MPM_PODX_GRACEFUL);
         retained->idle_spawn_rate[child_bucket] = 1;
     }
-    else if (idle_thread_count < min_spare_threads) {
+    else if (idle_thread_count < min_spare_threads / num_buckets) {
         /* terminate the free list */
         if (free_length == 0) { /* scoreboard is full, can't fork */
 
@@ -3004,7 +3004,10 @@ static int event_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s)
 
     restart_pending = shutdown_pending = 0;
     set_signals();
+
     /* Don't thrash... */
+    if (min_spare_threads < threads_per_child * num_buckets)
+        min_spare_threads = threads_per_child * num_buckets;
     if (max_spare_threads < min_spare_threads + threads_per_child * num_buckets)
         max_spare_threads = min_spare_threads + threads_per_child * num_buckets;
 
@@ -3196,7 +3199,6 @@ static int event_open_logs(apr_pool_t * p, apr_pool_t * plog,
     }
 
     enable_default_listener = 1;
-
     ap_duplicate_listeners(ap_server_conf, pconf, num_buckets);
 
     pod = apr_palloc(pconf, sizeof(ap_pod_t *) * num_buckets);
index a19304989f5889fffda6bd95d472e8aaeb22ffaf..a377865f73030a0b0a3014e75c967353fb7cd601 100644 (file)
@@ -2630,7 +2630,7 @@ static void perform_idle_server_maintenance(int child_bucket)
         ap_mpm_podx_signal(pod[child_bucket], AP_MPM_PODX_GRACEFUL);
         retained->idle_spawn_rate[child_bucket] = 1;
     }
-    else if (idle_thread_count < min_spare_threads) {
+    else if (idle_thread_count < min_spare_threads / num_buckets) {
         /* terminate the free list */
         if (free_length == 0) { /* scoreboard is full, can't fork */
 
@@ -2825,7 +2825,10 @@ static int event_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s)
 
     restart_pending = shutdown_pending = 0;
     set_signals();
+
     /* Don't thrash... */
+    if (min_spare_threads < threads_per_child * num_buckets)
+        min_spare_threads = threads_per_child * num_buckets;
     if (max_spare_threads < min_spare_threads + threads_per_child * num_buckets)
         max_spare_threads = min_spare_threads + threads_per_child * num_buckets;
 
@@ -3009,7 +3012,6 @@ static int event_open_logs(apr_pool_t * p, apr_pool_t * plog,
     }
 
     enable_default_listener = 0;
-
     if ((num_listensocks = ap_setup_listeners(ap_server_conf)) < 1) {
         ap_log_error(APLOG_MARK, APLOG_ALERT | level_flags, 0,
                      (startup ? NULL : s),
index ab350f60ec4f8e610a2e3be6d3d420a1c37aa3b5..70261fc11c34b4f15b9cf87a4fd73bd5b0019aa2 100644 (file)
@@ -1616,7 +1616,7 @@ static void perform_idle_server_maintenance(int child_bucket)
         ap_mpm_podx_signal(pod[child_bucket], AP_MPM_PODX_GRACEFUL);
         retained->idle_spawn_rate[child_bucket] = 1;
     }
-    else if (idle_thread_count < min_spare_threads) {
+    else if (idle_thread_count < min_spare_threads / num_buckets) {
         /* terminate the free list */
         if (free_length == 0) { /* scoreboard is full, can't fork */
 
@@ -1834,7 +1834,10 @@ static int worker_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
 
     restart_pending = shutdown_pending = 0;
     set_signals();
+
     /* Don't thrash... */
+    if (min_spare_threads < threads_per_child * num_buckets)
+        min_spare_threads = threads_per_child * num_buckets;
     if (max_spare_threads < min_spare_threads + threads_per_child * num_buckets)
         max_spare_threads = min_spare_threads + threads_per_child * num_buckets;