From: Cliff Woolley Date: Fri, 5 Sep 2003 19:00:53 +0000 (+0000) Subject: last minute stuff for 2.0.48: X-Git-Tag: 2.0.48~99 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1f2c91b7cff8e213f81ff3c9c46995a54ff2c04;p=thirdparty%2Fapache%2Fhttpd.git last minute stuff for 2.0.48: - 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 --- diff --git a/CHANGES b/CHANGES index e3e925e2313..3befece61b2 100644 --- 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 f8d3e3b77de..19a22d730a2 100644 --- 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 diff --git a/server/mpm/beos/beos.c b/server/mpm/beos/beos.c index 9d34849d433..2c68d69eaf0 100644 --- a/server/mpm/beos/beos.c +++ b/server/mpm/beos/beos.c @@ -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)); diff --git a/server/mpm/experimental/leader/leader.c b/server/mpm/experimental/leader/leader.c index 6f942da5c6e..035b5d49864 100644 --- a/server/mpm/experimental/leader/leader.c +++ b/server/mpm/experimental/leader/leader.c @@ -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)); diff --git a/server/mpm/experimental/perchild/perchild.c b/server/mpm/experimental/perchild/perchild.c index 0978480226c..69308c72bf7 100644 --- a/server/mpm/experimental/perchild/perchild.c +++ b/server/mpm/experimental/perchild/perchild.c @@ -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)); diff --git a/server/mpm/experimental/threadpool/threadpool.c b/server/mpm/experimental/threadpool/threadpool.c index 3f70345ac19..64f4647e915 100644 --- a/server/mpm/experimental/threadpool/threadpool.c +++ b/server/mpm/experimental/threadpool/threadpool.c @@ -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)); diff --git a/server/mpm/mpmt_os2/mpmt_os2.c b/server/mpm/mpmt_os2/mpmt_os2.c index 3888417f41e..214834cad4c 100644 --- a/server/mpm/mpmt_os2/mpmt_os2.c +++ b/server/mpm/mpmt_os2/mpmt_os2.c @@ -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; } diff --git a/server/mpm/mpmt_os2/mpmt_os2_child.c b/server/mpm/mpmt_os2/mpmt_os2_child.c index fe7fba207ad..af55e6de289 100644 --- a/server/mpm/mpmt_os2/mpmt_os2_child.c +++ b/server/mpm/mpmt_os2/mpmt_os2_child.c @@ -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); } diff --git a/server/mpm/netware/mpm_netware.c b/server/mpm/netware/mpm_netware.c index 8db931e6e41..67dffb03ee5 100644 --- a/server/mpm/netware/mpm_netware.c +++ b/server/mpm/netware/mpm_netware.c @@ -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; } diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 1b92f8471eb..8701918c9a1 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -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)); diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index cb0996e2677..6d736feb236 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -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)); diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c index 50f350381ba..ec7b8e2d2f5 100644 --- a/server/mpm/worker/worker.c +++ b/server/mpm/worker/worker.c @@ -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));