From: Bill Stoddard Date: Thu, 11 Dec 2003 02:02:09 +0000 (+0000) Subject: Win32: Implement MaxMemFree directive X-Git-Tag: 2.0.49~298 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=609bb8d906c9046304ba2794094ab2585d079a48;p=thirdparty%2Fapache%2Fhttpd.git Win32: Implement MaxMemFree directive git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@102024 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 44e04c4b692..f829609e685 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,7 @@ Changes with Apache 2.0.49 + *) Win32 MPM: Implement MaxMemFree to enable setting an upper + limit on the amount of storage used by the bucket brigades + in each server thread. [Bill Stoddard] *) Modified the cache code to be header-location agnostic. Also fixed a number of other cache code bugs related to PR 15852. diff --git a/STATUS b/STATUS index 6a569d95e99..93915bcaf3c 100644 --- a/STATUS +++ b/STATUS @@ -1,5 +1,5 @@ APACHE 2.0 STATUS: -*-text-*- -Last modified at [$Date: 2003/12/10 23:01:00 $] +Last modified at [$Date: 2003/12/11 02:02:08 $] Release: @@ -89,14 +89,6 @@ PATCHES TO BACKPORT FROM 2.1 http://cvs.apache.org/viewcvs/httpd-2.0/server/mpm/prefork/prefork.c.diff?r1=1.279&r2=1.280 +1: jorton, trawick - * Make Win32 MPM honor MaxMemFree for transaction pools - server/mpm/winnt/child.c: r1.17 - server/mpm/winnt/mpm.h: r1.14 - +1: stoddard - +1 (concept): trawick (looks reasonable when compared with worker) - +1 (concept): jwoolley (same reason. though why is ptrans no longer - a child pool of pchild?) - * parsed_uri.port is only valid iff parsed_uri.port_str != NULL. Old code simply checked if it was non-zero, not if it was *valid* @@ -345,7 +337,7 @@ PATCHES TO BACKPORT FROM 2.1 * Fix a long delay with CGI requests and keepalive connections on AIX. modules/generators/mod_cgid.c r1.159 - +1: trawick + +1: trawick, stoddard * mod_status hook configure.in r1.254 diff --git a/docs/manual/mod/mpm_common.xml b/docs/manual/mod/mpm_common.xml index 546f3e7ecf0..0fa3ee46ac7 100644 --- a/docs/manual/mod/mpm_common.xml +++ b/docs/manual/mod/mpm_common.xml @@ -387,7 +387,7 @@ to hold without calling free() server config beosleader mpm_netwareprefork -threadpoolworker +threadpoolworkermpm_winnt

The MaxMemFree directive sets the diff --git a/docs/manual/mod/mpm_winnt.xml b/docs/manual/mod/mpm_winnt.xml index 59a90233a64..a42e7c34eba 100644 --- a/docs/manual/mod/mpm_winnt.xml +++ b/docs/manual/mod/mpm_winnt.xml @@ -27,6 +27,8 @@ NT. MaxRequestsPerChild +MaxMemFree + ScoreBoardFile SendBufferSize diff --git a/server/mpm/winnt/child.c b/server/mpm/winnt/child.c index d890db860db..91e987fb446 100644 --- a/server/mpm/winnt/child.c +++ b/server/mpm/winnt/child.c @@ -185,6 +185,8 @@ AP_DECLARE(PCOMP_CONTEXT) mpm_get_completion_context(void) * Multiple failures in the next two steps will cause the pchild pool * to 'leak' storage. I don't think this is worth fixing... */ + apr_allocator_t *allocator; + context = (PCOMP_CONTEXT) apr_pcalloc(pchild, sizeof(COMP_CONTEXT)); context->Overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); @@ -196,14 +198,17 @@ AP_DECLARE(PCOMP_CONTEXT) mpm_get_completion_context(void) } /* Create the tranaction pool */ - if ((rv = apr_pool_create(&context->ptrans, pchild)) != APR_SUCCESS) { + apr_allocator_create(&allocator); + apr_allocator_max_free_set(allocator, ap_max_mem_free); + rv = apr_pool_create_ex(&context->ptrans, pchild, NULL, allocator); + if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK,APLOG_WARNING, rv, ap_server_conf, "mpm_get_completion_context: Failed to create the transaction pool."); CloseHandle(context->Overlapped.hEvent); return NULL; } - apr_pool_tag(context->ptrans, "ptrans"); - + apr_pool_tag(context->ptrans, "transaction"); + apr_allocator_owner_set(allocator, context->ptrans); context->accept_socket = INVALID_SOCKET; context->ba = apr_bucket_alloc_create(pchild); apr_atomic_inc(&num_completion_contexts); @@ -437,9 +442,12 @@ static PCOMP_CONTEXT win9x_get_connection(PCOMP_CONTEXT context) if (context == NULL) { /* allocate the completion context and the transaction pool */ + apr_allocator_t *allocator; context = apr_pcalloc(pchild, sizeof(COMP_CONTEXT)); - apr_pool_create(&context->ptrans, pchild); - apr_pool_tag(context->ptrans, "ptrans"); + apr_allocator_create(&allocator); + apr_allocator_max_free_set(allocator, ap_max_mem_free); + apr_pool_create_ex(&context->ptrans, pchild, NULL, allocator); + apr_pool_tag(context->ptrans, "transaction"); context->ba = apr_bucket_alloc_create(pchild); } diff --git a/server/mpm/winnt/mpm.h b/server/mpm/winnt/mpm.h index 0c0825a0cb6..08bcf91f7c3 100644 --- a/server/mpm/winnt/mpm.h +++ b/server/mpm/winnt/mpm.h @@ -72,6 +72,7 @@ #define AP_MPM_WANT_SET_MAX_REQUESTS #define AP_MPM_WANT_SET_COREDUMPDIR #define AP_MPM_WANT_SET_SCOREBOARD +#define AP_MPM_WANT_SET_MAX_MEM_FREE extern int ap_threads_per_child; extern int ap_thread_limit;