Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 49951 invoked from network); 5 Oct 2007 06:07:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Oct 2007 06:07:45 -0000 Received: (qmail 96689 invoked by uid 500); 5 Oct 2007 06:07:28 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 96635 invoked by uid 500); 5 Oct 2007 06:07:27 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 96624 invoked by uid 99); 5 Oct 2007 06:07:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Oct 2007 23:07:27 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of bojan@rexursive.com designates 203.171.74.242 as permitted sender) Received: from [203.171.74.242] (HELO beauty.rexursive.com) (203.171.74.242) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Oct 2007 06:07:30 +0000 Received: from [172.27.0.24] (shrek.rexursive.com [172.27.0.24]) by beauty.rexursive.com (Postfix) with ESMTP id E782840386 for ; Fri, 5 Oct 2007 16:06:38 +1000 (EST) Subject: Re: Cleanup/desctruction of connection pool and associated bucket_alloc From: Bojan Smojver To: dev@httpd.apache.org In-Reply-To: <1191562677.2964.27.camel@shrek.rexursive.com> References: <1191562677.2964.27.camel@shrek.rexursive.com> Content-Type: multipart/mixed; boundary="=-hYkY7pxFdUO3b3zETGrz" Date: Fri, 05 Oct 2007 16:06:38 +1000 Message-Id: <1191564398.2964.29.camel@shrek.rexursive.com> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 (2.10.3-4.fc7) X-Virus-Checked: Checked by ClamAV on apache.org --=-hYkY7pxFdUO3b3zETGrz Content-Type: text/plain Content-Transfer-Encoding: 7bit On Fri, 2007-10-05 at 15:37 +1000, Bojan Smojver wrote: > - make conn->pool have/own its own allocator > - destroy, rather then clear conn->pool on connection close Example patch attached. -- Bojan --=-hYkY7pxFdUO3b3zETGrz Content-Disposition: attachment; filename=core-connection-pool.patch Content-Type: text/x-patch; name=core-connection-pool.patch; charset=utf-8 Content-Transfer-Encoding: 7bit --- httpd-2.2.6/server/core.c 2007-08-07 22:12:20.000000000 +1000 +++ httpd-2.2.6-patched/server/core.c 2007-10-05 15:57:36.000000000 +1000 @@ -3872,7 +3872,21 @@ apr_bucket_alloc_t *alloc) { apr_status_t rv; - conn_rec *c = (conn_rec *) apr_pcalloc(ptrans, sizeof(conn_rec)); + apr_allocator_t *aa; + apr_pool_t *pool; + apr_bucket_alloc_t *ba; + conn_rec *c; + + apr_allocator_create(&aa); + apr_pool_create_ex(&pool,ptrans,NULL,aa); + if (aa) { + apr_allocator_owner_set(aa, pool); + } + apr_pool_tag(pool, "connection"); + + ba = apr_bucket_alloc_create(pool); + + c = apr_pcalloc(pool, sizeof(conn_rec)); c->sbh = sbh; (void)ap_update_child_status(c->sbh, SERVER_BUSY_READ, (request_rec *)NULL); @@ -3880,10 +3894,10 @@ /* Got a connection structure, so initialize what fields we can * (the rest are zeroed out by pcalloc). */ - c->conn_config = ap_create_conn_config(ptrans); - c->notes = apr_table_make(ptrans, 5); + c->conn_config = ap_create_conn_config(pool); + c->notes = apr_table_make(pool, 5); - c->pool = ptrans; + c->pool = pool; if ((rv = apr_socket_addr_get(&c->local_addr, APR_LOCAL, csd)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_INFO, rv, server, @@ -3905,7 +3919,7 @@ c->base_server = server; c->id = id; - c->bucket_alloc = alloc; + c->bucket_alloc = ba; return c; } --=-hYkY7pxFdUO3b3zETGrz--