c49bed
diff --git a/include/scoreboard.h b/include/scoreboard.h
c49bed
index 9376da2..92d198d 100644
c49bed
--- a/include/scoreboard.h
c49bed
+++ b/include/scoreboard.h
c49bed
@@ -148,7 +148,9 @@ struct process_score {
c49bed
     apr_uint32_t lingering_close;   /* async connections in lingering close */
c49bed
     apr_uint32_t keep_alive;        /* async connections in keep alive */
c49bed
     apr_uint32_t suspended;         /* connections suspended by some module */
c49bed
-    int bucket;             /* Listener bucket used by this child */
c49bed
+    int bucket;  /* Listener bucket used by this child; this field is DEPRECATED
c49bed
+                  * and no longer updated by the MPMs (i.e. always zero).
c49bed
+                  */
c49bed
 };
c49bed
 
c49bed
 /* Scoreboard is now in 'local' memory, since it isn't updated once created,
c49bed
diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c
c49bed
index ffe8a23..048ae61 100644
c49bed
--- a/server/mpm/event/event.c
c49bed
+++ b/server/mpm/event/event.c
c49bed
@@ -2695,7 +2695,6 @@ static int make_child(server_rec * s, int slot, int bucket)
c49bed
 
c49bed
     ap_scoreboard_image->parent[slot].quiescing = 0;
c49bed
     ap_scoreboard_image->parent[slot].not_accepting = 0;
c49bed
-    ap_scoreboard_image->parent[slot].bucket = bucket;
c49bed
     event_note_child_started(slot, pid);
c49bed
     active_daemons++;
c49bed
     retained->total_daemons++;
c49bed
@@ -2734,6 +2733,7 @@ static void perform_idle_server_maintenance(int child_bucket, int num_buckets)
c49bed
          * that threads_per_child is always > 0 */
c49bed
         int status = SERVER_DEAD;
c49bed
         int child_threads_active = 0;
c49bed
+        int bucket = i % num_buckets;
c49bed
 
c49bed
         if (i >= retained->max_daemons_limit &&
c49bed
             free_length == retained->idle_spawn_rate[child_bucket]) {
c49bed
@@ -2757,7 +2757,7 @@ static void perform_idle_server_maintenance(int child_bucket, int num_buckets)
c49bed
                  */
c49bed
                 if (status <= SERVER_READY && !ps->quiescing && !ps->not_accepting
c49bed
                     && ps->generation == retained->mpm->my_generation
c49bed
-                    && ps->bucket == child_bucket)
c49bed
+                    && bucket == child_bucket)
c49bed
                 {
c49bed
                     ++idle_thread_count;
c49bed
                 }
c49bed
@@ -2768,7 +2768,9 @@ static void perform_idle_server_maintenance(int child_bucket, int num_buckets)
c49bed
             last_non_dead = i;
c49bed
         }
c49bed
         active_thread_count += child_threads_active;
c49bed
-        if (!ps->pid && free_length < retained->idle_spawn_rate[child_bucket])
c49bed
+        if (!ps->pid
c49bed
+                && bucket == child_bucket
c49bed
+                && free_length < retained->idle_spawn_rate[child_bucket])
c49bed
             free_slots[free_length++] = i;
c49bed
         else if (child_threads_active == threads_per_child)
c49bed
             had_healthy_child = 1;
c49bed
@@ -2951,13 +2953,14 @@ static void server_main_loop(int remaining_children_to_start, int num_buckets)
c49bed
                 retained->total_daemons--;
c49bed
                 if (processed_status == APEXIT_CHILDSICK) {
c49bed
                     /* resource shortage, minimize the fork rate */
c49bed
-                    retained->idle_spawn_rate[ps->bucket] = 1;
c49bed
+                    retained->idle_spawn_rate[child_slot % num_buckets] = 1;
c49bed
                 }
c49bed
                 else if (remaining_children_to_start) {
c49bed
                     /* we're still doing a 1-for-1 replacement of dead
c49bed
                      * children with new children
c49bed
                      */
c49bed
-                    make_child(ap_server_conf, child_slot, ps->bucket);
c49bed
+                    make_child(ap_server_conf, child_slot,
c49bed
+                               child_slot % num_buckets);
c49bed
                     --remaining_children_to_start;
c49bed
                 }
c49bed
             }
c49bed
diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c
c49bed
index 8efda72..7c00625 100644
c49bed
--- a/server/mpm/prefork/prefork.c
c49bed
+++ b/server/mpm/prefork/prefork.c
c49bed
@@ -637,8 +637,9 @@ static void child_main(int child_num_arg, int child_bucket)
c49bed
 }
c49bed
 
c49bed
 
c49bed
-static int make_child(server_rec *s, int slot, int bucket)
c49bed
+static int make_child(server_rec *s, int slot)
c49bed
 {
c49bed
+    int bucket = slot % retained->mpm->num_buckets;
c49bed
     int pid;
c49bed
 
c49bed
     if (slot + 1 > retained->max_daemons_limit) {
c49bed
@@ -716,7 +717,6 @@ static int make_child(server_rec *s, int slot, int bucket)
c49bed
         child_main(slot, bucket);
c49bed
     }
c49bed
 
c49bed
-    ap_scoreboard_image->parent[slot].bucket = bucket;
c49bed
     prefork_note_child_started(slot, pid);
c49bed
 
c49bed
     return 0;
c49bed
@@ -732,7 +732,7 @@ static void startup_children(int number_to_start)
c49bed
         if (ap_scoreboard_image->servers[i][0].status != SERVER_DEAD) {
c49bed
             continue;
c49bed
         }
c49bed
-        if (make_child(ap_server_conf, i, i % retained->mpm->num_buckets) < 0) {
c49bed
+        if (make_child(ap_server_conf, i) < 0) {
c49bed
             break;
c49bed
         }
c49bed
         --number_to_start;
c49bed
@@ -741,8 +741,6 @@ static void startup_children(int number_to_start)
c49bed
 
c49bed
 static void perform_idle_server_maintenance(apr_pool_t *p)
c49bed
 {
c49bed
-    static int bucket_make_child_record = -1;
c49bed
-    static int bucket_kill_child_record = -1;
c49bed
     int i;
c49bed
     int idle_count;
c49bed
     worker_score *ws;
c49bed
@@ -789,6 +787,7 @@ static void perform_idle_server_maintenance(apr_pool_t *p)
c49bed
     }
c49bed
     retained->max_daemons_limit = last_non_dead + 1;
c49bed
     if (idle_count > ap_daemons_max_free) {
c49bed
+        static int bucket_kill_child_record = -1;
c49bed
         /* kill off one child... we use the pod because that'll cause it to
c49bed
          * shut down gracefully, in case it happened to pick up a request
c49bed
          * while we were counting
c49bed
@@ -819,10 +818,7 @@ static void perform_idle_server_maintenance(apr_pool_t *p)
c49bed
                     idle_count, total_non_dead);
c49bed
             }
c49bed
             for (i = 0; i < free_length; ++i) {
c49bed
-                bucket_make_child_record++;
c49bed
-                bucket_make_child_record %= retained->mpm->num_buckets;
c49bed
-                make_child(ap_server_conf, free_slots[i],
c49bed
-                           bucket_make_child_record);
c49bed
+                make_child(ap_server_conf, free_slots[i]);
c49bed
             }
c49bed
             /* the next time around we want to spawn twice as many if this
c49bed
              * wasn't good enough, but not if we've just done a graceful
c49bed
@@ -867,7 +863,7 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
c49bed
 
c49bed
     if (one_process) {
c49bed
         AP_MONCONTROL(1);
c49bed
-        make_child(ap_server_conf, 0, 0);
c49bed
+        make_child(ap_server_conf, 0);
c49bed
         /* NOTREACHED */
c49bed
         ap_assert(0);
c49bed
         return !OK;
c49bed
@@ -976,8 +972,7 @@ static int prefork_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
c49bed
                     /* we're still doing a 1-for-1 replacement of dead
c49bed
                      * children with new children
c49bed
                      */
c49bed
-                    make_child(ap_server_conf, child_slot,
c49bed
-                               ap_get_scoreboard_process(child_slot)->bucket);
c49bed
+                    make_child(ap_server_conf, child_slot);
c49bed
                     --remaining_children_to_start;
c49bed
                 }
c49bed
 #if APR_HAS_OTHER_CHILD
c49bed
diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c
c49bed
index 8012fe2..a927942 100644
c49bed
--- a/server/mpm/worker/worker.c
c49bed
+++ b/server/mpm/worker/worker.c
c49bed
@@ -1339,7 +1339,6 @@ static int make_child(server_rec *s, int slot, int bucket)
c49bed
         worker_note_child_lost_slot(slot, pid);
c49bed
     }
c49bed
     ap_scoreboard_image->parent[slot].quiescing = 0;
c49bed
-    ap_scoreboard_image->parent[slot].bucket = bucket;
c49bed
     worker_note_child_started(slot, pid);
c49bed
     return 0;
c49bed
 }
c49bed
@@ -1388,6 +1387,7 @@ static void perform_idle_server_maintenance(int child_bucket, int num_buckets)
c49bed
         int any_dead_threads = 0;
c49bed
         int all_dead_threads = 1;
c49bed
         int child_threads_active = 0;
c49bed
+        int bucket = i % num_buckets;
c49bed
 
c49bed
         if (i >= retained->max_daemons_limit &&
c49bed
             totally_free_length == retained->idle_spawn_rate[child_bucket]) {
c49bed
@@ -1420,7 +1420,7 @@ static void perform_idle_server_maintenance(int child_bucket, int num_buckets)
c49bed
                 if (status <= SERVER_READY &&
c49bed
                         !ps->quiescing &&
c49bed
                         ps->generation == retained->mpm->my_generation &&
c49bed
-                        ps->bucket == child_bucket) {
c49bed
+                        bucket == child_bucket) {
c49bed
                     ++idle_thread_count;
c49bed
                 }
c49bed
                 if (status >= SERVER_READY && status < SERVER_GRACEFUL) {
c49bed
@@ -1430,6 +1430,7 @@ static void perform_idle_server_maintenance(int child_bucket, int num_buckets)
c49bed
         }
c49bed
         active_thread_count += child_threads_active;
c49bed
         if (any_dead_threads
c49bed
+                && bucket == child_bucket
c49bed
                 && totally_free_length < retained->idle_spawn_rate[child_bucket]
c49bed
                 && free_length < MAX_SPAWN_RATE / num_buckets
c49bed
                 && (!ps->pid               /* no process in the slot */
c49bed
@@ -1615,14 +1616,15 @@ static void server_main_loop(int remaining_children_to_start, int num_buckets)
c49bed
                 ps->quiescing = 0;
c49bed
                 if (processed_status == APEXIT_CHILDSICK) {
c49bed
                     /* resource shortage, minimize the fork rate */
c49bed
-                    retained->idle_spawn_rate[ps->bucket] = 1;
c49bed
+                    retained->idle_spawn_rate[child_slot % num_buckets] = 1;
c49bed
                 }
c49bed
                 else if (remaining_children_to_start
c49bed
                     && child_slot < ap_daemons_limit) {
c49bed
                     /* we're still doing a 1-for-1 replacement of dead
c49bed
                      * children with new children
c49bed
                      */
c49bed
-                    make_child(ap_server_conf, child_slot, ps->bucket);
c49bed
+                    make_child(ap_server_conf, child_slot,
c49bed
+                               child_slot % num_buckets);
c49bed
                     --remaining_children_to_start;
c49bed
                 }
c49bed
             }