]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
last minute stuff for 2.0.48:
authorCliff Woolley <jwoolley@apache.org>
Fri, 5 Sep 2003 19:00:53 +0000 (19:00 +0000)
committerCliff Woolley <jwoolley@apache.org>
Fri, 5 Sep 2003 19:00:53 +0000 (19:00 +0000)
 - backport the maxmemfree change
 - add my comment on nd's mod_include rewrite to STATUS

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@101163 13f79535-47bb-0310-9956-ffa450edef68

12 files changed:
CHANGES
STATUS
server/mpm/beos/beos.c
server/mpm/experimental/leader/leader.c
server/mpm/experimental/perchild/perchild.c
server/mpm/experimental/threadpool/threadpool.c
server/mpm/mpmt_os2/mpmt_os2.c
server/mpm/mpmt_os2/mpmt_os2_child.c
server/mpm/netware/mpm_netware.c
server/mpm/prefork/prefork.c
server/mpm/winnt/mpm_winnt.c
server/mpm/worker/worker.c

diff --git a/CHANGES b/CHANGES
index e3e925e2313f4d129cffba72ed460e2845d567bc..3befece61b2ecc20255f91e673668e1080687f6d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.48
 
+  *) MPMs: The bucket brigades subsystem now honors the MaxMemFree setting.
+     [Cliff Woolley, Jean-Jacques Clar]
+
   *) Install config.nice into the build/ directory to make
      minor version upgrades easier. [Joshua Slive]
 
diff --git a/STATUS b/STATUS
index f8d3e3b77ded938a3cc773f4d10958e8cb74dee8..19a22d730a2f563b95f68af65924a55ddbace0a1 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,5 +1,5 @@
 APACHE 2.0 STATUS:                                              -*-text-*-
-Last modified at [$Date: 2003/09/05 18:03:09 $]
+Last modified at [$Date: 2003/09/05 19:00:51 $]
 
 Release:
 
@@ -341,6 +341,7 @@ PATCHES TO PORT FROM 2.1
                   internal meaning I do not think that the change requires a
                   bump.
       +1: nd, brianp
+      jwoolley suggests: Hang onto it for 2.2 series.
 
     * Fix include_cmd in mod_cgid, not to treat the cmd output (partially)
       as CGI output.
@@ -358,19 +359,6 @@ PATCHES TO PORT FROM 2.1
         modules/filters/mod_include.c: r1.264
       +1: nd
 
-    * all MPM's: correctly honor MaxMemFree
-        server/mpm/beos/beos.c: r1.101, r1.102
-        server/mpm/experimental/leader/leader.c: r1.29, r1.30
-        server/mpm/experimental/threadpool/perchild.c: r1.139
-        server/mpm/experimental/threadpool/threadpool.c: r1.17, r1.18
-        server/mpm/mpmt_os2/mpmt_os2.c: r1.25
-        server/mpm/mpmt_os2/mpmt_os2_child.c: r1.25
-        server/mpm/netware/mpm_netware.c: r1.71, r1.72
-        server/mpm/netware/prefork.c: r1.279
-        server/mpm/netware/mpm_winnt.c: r1.300
-        server/mpm/worker/worker.c: r1.136, r1.137
-      +1: jwoolley, bnicholes, striker
-
     * mod_ssl: fix check for the plain-HTTP-request error
         modules/ssl/ssl_engine_io.c r1.111
       +1: jorton
index 9d34849d43391c226412bba0926a9eb5767e7565..2c68d69eaf0e739cd791375cae4293657bc05df4 100644 (file)
@@ -390,6 +390,8 @@ static int32 worker_thread(void * dummy)
 
     apr_pool_tag(ptrans, "transaction");
 
+    bucket_alloc = apr_bucket_alloc_create_ex(allocator);
+
     apr_thread_mutex_lock(worker_thread_count_mutex);
     worker_thread_count++;
     apr_thread_mutex_unlock(worker_thread_count_mutex);
@@ -400,8 +402,6 @@ static int32 worker_thread(void * dummy)
     apr_poll_setup(&pollset, num_listening_sockets + 1, tpool);
     for(n=0 ; n <= num_listening_sockets ; n++)
         apr_poll_socket_add(pollset, listening_sockets[n], APR_POLLIN);
-       
-    bucket_alloc = apr_bucket_alloc_create(tpool);
 
     while (1) {
         /* If we're here, then chances are (unless we're the first thread created) 
@@ -1047,6 +1047,9 @@ static int beos_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptem
     ap_thread_limit = HARD_THREAD_LIMIT;
     ap_pid_fname = DEFAULT_PIDLOG;
     ap_max_requests_per_thread = DEFAULT_MAX_REQUESTS_PER_THREAD;
+#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
+       ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
+#endif
 
     apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
 
index 6f942da5c6edee11132bc4efd19a28be8689609e..035b5d4986452bdc791d47d3be21fa5a6dd9795e 100644 (file)
@@ -781,9 +781,10 @@ static void *worker_thread(apr_thread_t *thd, void * dummy)
 
     apr_allocator_create(&allocator);
     apr_allocator_max_free_set(allocator, ap_max_mem_free);
+    /* XXX: why is ptrans's parent not tpool?  --jcw 08/2003 */
     apr_pool_create_ex(&ptrans, NULL, NULL, allocator);
     apr_allocator_owner_set(allocator, ptrans);
-    bucket_alloc = apr_bucket_alloc_create(tpool);
+    bucket_alloc = apr_bucket_alloc_create_ex(allocator);
 
     apr_poll_setup(&pollset, num_listensocks, tpool);
     for(lr = ap_listeners ; lr != NULL ; lr = lr->next)
@@ -1799,6 +1800,9 @@ static int leader_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
     ap_lock_fname = DEFAULT_LOCKFILE;
     ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
     ap_extended_status = 0;
+#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
+       ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
+#endif
 
     apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
 
index 0978480226ceccb527d4dfa69032979bd4e1904c..69308c72bf73f4305024013a1573d6217d96d7a7 100644 (file)
@@ -1597,6 +1597,9 @@ static int perchild_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptem
     ap_lock_fname = DEFAULT_LOCKFILE;
     ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
     curr_child_num = 0;
+#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
+       ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
+#endif
 
     apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
 
index 3f70345ac19e4dfa8f54b9792253a8cecdfa78d4..64f4647e915bd9d2d129599abe561d8b7ffecbf7 100644 (file)
@@ -1047,12 +1047,10 @@ static void * APR_THREAD_FUNC worker_thread(apr_thread_t *thd, void * dummy)
 
     apr_allocator_create(&allocator);
     apr_allocator_max_free_set(allocator, ap_max_mem_free);
+    /* XXX: why is ptrans's parent not tpool? --jcw 08/2003 */
     apr_pool_create_ex(&ptrans, NULL, NULL, allocator);
     apr_allocator_owner_set(allocator, ptrans);
-
-    /* XXX: What happens if this is allocated from the
-     * single-thread-optimized ptrans pool? -aaron */
-    bucket_alloc = apr_bucket_alloc_create(tpool);
+    bucket_alloc = apr_bucket_alloc_create_ex(allocator);
 
     wakeup = (worker_wakeup_info *)apr_palloc(tpool, sizeof(*wakeup));
     wakeup->pool = ptrans;
@@ -2056,6 +2054,9 @@ static int worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
     ap_lock_fname = DEFAULT_LOCKFILE;
     ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
     ap_extended_status = 0;
+#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
+       ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
+#endif
 
     apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
 
index 3888417f41e2646c105dd3c5040fbc1c3772a070..214834cad4c6e2251c44648a00c0a98e6af200b5 100644 (file)
@@ -512,6 +512,9 @@ static int mpmt_os2_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *
     ap_extended_status = 0;
     ap_min_spare_threads = DEFAULT_MIN_SPARE_THREAD;
     ap_max_spare_threads = DEFAULT_MAX_SPARE_THREAD;
+#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
+       ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
+#endif
 
     return OK;
 }
index fe7fba207ad29124f24e7a6f4a2cff4d36efade8..af55e6de2893d896d7258ae576f101ce3eaed8e2 100644 (file)
@@ -402,6 +402,7 @@ static void worker_main(void *vpArg)
     long conn_id;
     conn_rec *current_conn;
     apr_pool_t *pconn;
+    apr_allocator_t *allocator;
     apr_bucket_alloc_t *bucket_alloc;
     worker_args_t *worker_args;
     HQUEUE workq;
@@ -430,10 +431,13 @@ static void worker_main(void *vpArg)
     ap_update_child_status_from_indexes(child_slot, thread_slot, SERVER_READY, 
                                         NULL);
 
+    apr_allocator_create(&allocator);
+    apr_allocator_max_free_set(allocator, ap_max_mem_free);
+    bucket_alloc = apr_bucket_alloc_create_ex(allocator);
+
     while (rc = DosReadQueue(workq, &rd, &len, (PPVOID)&worker_args, 0, DCWW_WAIT, &priority, NULLHANDLE),
            rc == 0 && rd.ulData != WORKTYPE_EXIT) {
         pconn = worker_args->pconn;
-        bucket_alloc = apr_bucket_alloc_create(pconn);
         ap_create_sb_handle(&sbh, pconn, child_slot, thread_slot);
         current_conn = ap_run_create_connection(pconn, ap_server_conf,
                                                 worker_args->conn_sd, conn_id,
@@ -451,6 +455,9 @@ static void worker_main(void *vpArg)
 
     ap_update_child_status_from_indexes(child_slot, thread_slot, SERVER_DEAD, 
                                         NULL);
+
+    apr_bucket_alloc_destroy(bucket_alloc);
+    apr_allocator_destroy(allocator);
 }
 
 
index 8db931e6e415008183a9da5da66db4cd64832613..67dffb03ee5ea715f141c6cf95af0d975ca9a767 100644 (file)
@@ -212,17 +212,16 @@ static int volatile wait_to_finish=1;
 ap_generation_t volatile ap_my_generation=0;
 
 /* a clean exit from a child with proper cleanup */
-static void clean_child_exit(int code, int worker_num, apr_pool_t *pthrd, 
-                             apr_bucket_alloc_t *bucket_alloc) __attribute__ ((noreturn));
-static void clean_child_exit(int code, int worker_num, apr_pool_t *pthrd, 
-                             apr_bucket_alloc_t *bucket_alloc)
+static void clean_child_exit(int code, int worker_num, apr_pool_t *ptrans)
+                             __attribute__ ((noreturn));
+static void clean_child_exit(int code, int worker_num, apr_pool_t *ptrans)
 {
     if (!shutdown_pending) {
         /* Destroying the thread pool should take
            care of the bucket allocator.  So
            there is no need to destroy the bucket
            allocator here also */
-        apr_pool_destroy(pthrd);
+        apr_pool_destroy(ptrans);
     }
 
     atomic_dec (&worker_thread_count);
@@ -362,7 +361,7 @@ static int avg_retries = 0;
 void worker_main(void *arg)
 {
     ap_listen_rec *lr, *first_lr, *last_lr = NULL;
-    apr_pool_t *ptrans, *pthrd;
+    apr_pool_t *ptrans;
     apr_pool_t *pbucket;
     apr_allocator_t *allocator;
     apr_bucket_alloc_t *bucket_alloc;
@@ -387,14 +386,11 @@ void worker_main(void *arg)
     apr_allocator_create(&allocator);
     apr_allocator_max_free_set(allocator, ap_max_mem_free);
 
-    apr_pool_create_ex(&pthrd, pmain, NULL, allocator);
-    apr_allocator_owner_set(allocator, pthrd);
-    apr_pool_tag(pthrd, "worker_thrd_pool");
-
-    apr_pool_create(&ptrans, pthrd);
+    apr_pool_create_ex(&ptrans, pmain, NULL, allocator);
+    apr_allocator_owner_set(allocator, ptrans);
     apr_pool_tag(ptrans, "transaction");
 
-    bucket_alloc = apr_bucket_alloc_create(pthrd);
+    bucket_alloc = apr_bucket_alloc_create_ex(allocator);
 
     atomic_inc (&worker_thread_count);
 
@@ -408,7 +404,7 @@ void worker_main(void *arg)
         if ((ap_max_requests_per_child > 0
             && requests_this_child++ >= ap_max_requests_per_child)) {
             DBPRINT1 ("\n**Thread slot %d is shutting down", my_worker_num);
-            clean_child_exit(0, my_worker_num, pthrd, bucket_alloc);
+            clean_child_exit(0, my_worker_num, ptrans);
         }
 
         ap_update_child_status_from_indexes(0, my_worker_num, WORKER_READY, 
@@ -421,7 +417,7 @@ void worker_main(void *arg)
         for (;;) {
             if (shutdown_pending || restart_pending || (ap_scoreboard_image->servers[0][my_worker_num].status == WORKER_IDLE_KILL)) {
                 DBPRINT1 ("\nThread slot %d is shutting down\n", my_worker_num);
-                clean_child_exit(0, my_worker_num, pthrd, bucket_alloc);
+                clean_child_exit(0, my_worker_num, ptrans);
             }
 
             /* Check the listen queue on all sockets for requests */
@@ -530,13 +526,12 @@ void worker_main(void *arg)
                         */
                         ap_log_error(APLOG_MARK, APLOG_EMERG, stat, ap_server_conf,
                             "apr_accept: giving up.");
-                        clean_child_exit(APEXIT_CHILDFATAL, my_worker_num, pthrd, 
-                                         bucket_alloc);
+                        clean_child_exit(APEXIT_CHILDFATAL, my_worker_num, ptrans);
                 }
                 else {
                         ap_log_error(APLOG_MARK, APLOG_ERR, stat, ap_server_conf,
                             "apr_accept: (client socket)");
-                        clean_child_exit(1, my_worker_num, pthrd, bucket_alloc);
+                        clean_child_exit(1, my_worker_num, ptrans);
                 }
             }
         }
@@ -555,7 +550,7 @@ void worker_main(void *arg)
         }
         request_count++;
     }
-    clean_child_exit(0, my_worker_num, pthrd, bucket_alloc);
+    clean_child_exit(0, my_worker_num, ptrans);
 }
 
 
@@ -1018,6 +1013,9 @@ static int netware_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp
     ap_threads_limit = HARD_THREAD_LIMIT;
     ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
     ap_extended_status = 0;
+#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
+       ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
+#endif
 
     return OK;
 }
index 1b92f8471eb2e671ee147439ffcebf992d109b03..8701918c9a19bc50540d85f4cc9accfff634bbfa 100644 (file)
@@ -1263,6 +1263,9 @@ static int prefork_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp
     ap_lock_fname = DEFAULT_LOCKFILE;
     ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
     ap_extended_status = 0;
+#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
+       ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
+#endif
 
     apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
 
index cb0996e2677813b03340758f4655d876728234dc..6d736feb236642e0ab9da707a04bbec7d89a2b32 100644 (file)
@@ -1386,6 +1386,9 @@ static int winnt_pre_config(apr_pool_t *pconf_, apr_pool_t *plog, apr_pool_t *pt
     ap_threads_per_child = DEFAULT_THREADS_PER_CHILD;
     ap_pid_fname = DEFAULT_PIDLOG;
     ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
+#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
+       ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
+#endif
 
     apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
 
index 50f350381ba8698490bd41e251c8d0b06ce4fe70..ec7b8e2d2f5ec86b3b44b5fbf40f9d52ee425589 100644 (file)
@@ -891,8 +891,6 @@ static void * APR_THREAD_FUNC worker_thread(apr_thread_t *thd, void * dummy)
 
     ap_update_child_status_from_indexes(process_slot, thread_slot, SERVER_STARTING, NULL);
 
-    bucket_alloc = apr_bucket_alloc_create(apr_thread_pool_get(thd));
-
     while (!workers_may_exit) {
         if (!is_idle) {
             rv = ap_queue_info_set_idle(worker_queue_info, last_ptrans);
@@ -944,6 +942,7 @@ worker_pop:
         }
         is_idle = 0;
         worker_sockets[thread_slot] = csd;
+        bucket_alloc = apr_bucket_alloc_create(ptrans);
         process_socket(ptrans, csd, process_slot, thread_slot, bucket_alloc);
         worker_sockets[thread_slot] = NULL;
         requests_this_child--; /* FIXME: should be synchronized - aaron */
@@ -954,8 +953,6 @@ worker_pop:
     ap_update_child_status_from_indexes(process_slot, thread_slot,
         (dying) ? SERVER_DEAD : SERVER_GRACEFUL, (request_rec *) NULL);
 
-    apr_bucket_alloc_destroy(bucket_alloc);
-
     apr_thread_exit(thd, APR_SUCCESS);
     return NULL;
 }
@@ -1919,6 +1916,9 @@ static int worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
     ap_lock_fname = DEFAULT_LOCKFILE;
     ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
     ap_extended_status = 0;
+#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE
+       ap_max_mem_free = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
+#endif
 
     apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));