Return-Path: Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 44667 invoked by uid 500); 5 Sep 2002 15:16:07 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 44651 invoked from network); 5 Sep 2002 15:16:07 -0000 To: dev@apr.apache.org Path: not-for-mail From: Ian Holsman Newsgroups: server.http.apr.dev Subject: Re: pool debug question. Date: Thu, 05 Sep 2002 08:16:09 -0700 Organization: Holsman.NET Lines: 45 Message-ID: <3D777539.3070204@apache.org> References: <3D758105.5040906@apache.org> NNTP-Posting-Host: int.holsman.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: flame.holsman.net 1031238968 13746 127.0.0.1 (5 Sep 2002 15:16:08 GMT) X-Complaints-To: news@flame.holsman.net NNTP-Posting-Date: Thu, 5 Sep 2002 15:16:08 +0000 (UTC) To: Sander Striker User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Sander Striker wrote: >>From: Ian Holsman [mailto:ianh@apache.org] >>Sent: 04 September 2002 05:42 > > >>hi all. >> >>I've got a piece of multi-threaded code which runs fine >>until it gets to the apr_terminate, where it segfaults in >>apr_allocator_destroy. >> >>any hints on what is going on ? > > > apr_initialize calls apr_pool_initialize which creates a > global allocator which is used for all pools (unless overridden). > The global allocator is protected by a mutex, which is allocated > out of the global pool (also created by apr_pool_initialize). > > apr_terminate calls apr_pool_terminate which in turn destroys > the global pool. The global pool is the owner of the global > allocator and thus destroys the global allocator after its own > destruction. The global pool cleanup _should_ already have > taken care of the destruction of the mutex and the resetting of > the mutex field of the global allocator. > > >>the test program is creating and destroying thousands of pools >>but is not messing at all with allocators > > > Are you sure you are not calling apr_terminate before all threads > have finished? If you are we have a nice thing to debug :( > This could be the problem, as the program is creating/exiting threads several times. but I am 99.9% sure that they are all dead before I terminate (this is what msvc's debugger shows me) The code is on http://webperf.org/a2/prob/ it's the start of a dynamically sizing mpm (it spawns more threads when the queue is getting bigger, longer term it will base it's decision on response times) > Sander >