Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 99713 invoked from network); 16 Mar 2006 16:28:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 16 Mar 2006 16:28:41 -0000 Received: (qmail 11980 invoked by uid 500); 16 Mar 2006 16:28:28 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 11905 invoked by uid 500); 16 Mar 2006 16:28:28 -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 11796 invoked by uid 99); 16 Mar 2006 16:28:27 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Mar 2006 08:28:27 -0800 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [137.65.81.169] (HELO sinclair.provo.novell.com) (137.65.81.169) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Mar 2006 08:28:27 -0800 Received: from INET-PRV-MTA by sinclair.provo.novell.com with Novell_GroupWise; Thu, 16 Mar 2006 09:28:04 -0700 Message-Id: <44192F26.6720.00AC.0@novell.com> X-Mailer: Novell GroupWise Internet Agent 7.0.1 Beta Date: Thu, 16 Mar 2006 09:27:56 -0700 From: "Brad Nicholes" To: , Subject: Re: pool use/mutex initialization in util_ldap not thread safe? References: <441846B7.6720.00AC.0@novell.com> <441956D0.7080309@apache.org> In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 500/1000/N >>> On 3/16/2006 at 7:12 am, in message , "Jeff Trawick" wrote: > On 3/16/06, Ruediger Pluem wrote: >> >> >> On 03/16/2006 03:49 AM, Jeff Trawick wrote: >> > On 3/15/06, Brad Nicholes wrote: >> >> > >> > That is really one pool globally but there is a mutex per server_rec. >> > So a thread handling a request for one vhost grabs the mutex and uses >> > the pool but that doesn't protect from a thread handling a request for >> > a different vhost which grabs a different mutex supposedly protecting >> > the same pool. >> >> Would it help to create sub-pools per server_rec from the config pool? > > That sounds like a definite improvement, but I'm eager for LDAP gurus > to explain how pool growth is mitigated in the current design > (assuming thread safety) before jumping to a conclusion The use of the pool is actually fairly limited. It is used to create and initialize the reusable LDAP resources such as ldap connections. The pool of ldap connections can grow but that is based on the amount of traffic that requires LDAP authentication. Even under very heavy use, the number of connections in the connection pool might be ~20 but even that is a generous number. Any per-request memory allocations are done from the request pool. So the potential for collisions within the global memory pool, although not 0, would be very low. The purpose of the mutex is not necessarily to protect the memory pool but to protect the ldap connection pool. Whenever mod_ldap needs to pull a connection from the ldap connection pool, it first grabs the mutex so that it is free to search for a connection and modify its parameters without having to worry about other threads doing the same thing. Since most of the global memory pool usage, outside of module initialization, also occurs after the connection pool mutex has been locked, this also lessens the chance of memory pool collisions. However, given all of there, I still think that there are things that need to be cleaned up especially with the mutex allocation and use in a worker MPM environment. Brad