apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sander Striker <stri...@apache.org>
Subject Re: apr_allocator_destroy infinite loop
Date Wed, 27 Jul 2005 09:23:15 GMT
Cliff Woolley wrote:
> On Mon, 25 Jul 2005, Wilson, Brian A wrote:
> 
> 
>>I'm trying to track down an error when closing a program using apr.  In
>>the jxta-c shell it calls apr_terminate upon exit but it ends up in an
>>infinite while loop in apr_allocator_destroy.  I've traced it down to a
>>point where the while loop is being called on a circular pair of nodes.
>>Such that A->next = B and B->next = A.  I've tried adding an escape
>>check to exit if it gets to that situation but that leaves large amounts
>>of memory lost.  Any ideas on what could be the cause and possible
>>solutions?
> 
> 
> I'm guessing the best way to attack this is to figure out where the loop
> came from in the first place rather than simply detecting it and
> compensating after the fact.  There are a number of pool debugging options
> you can enable that might help here... CC: Sander to comment on which ones
> would be most useful in this particular scenario.

First would be to compile with --enable-pool-debug=yes.  Or even:
--enable-pool-debug="lifetime owner".  Your application will abort()
when something is fishy.

FYI, possible options are:
   --enable-pool-debug[[=yes|no|verbose|verbose-alloc|lifetime|owner|all]]

I don't think you need verbose-alloc to track this down.

In case you suspect corruption because of reuse of freed memory (cleared/destroyed
pool), you could try with simply --enable-pool-debug=yes, and then using
a tool like valgrind to figure out where the problem is.

If you know what pools are causing the trouble, or when you've tagged
your pools (see: apr_pool_tag()), you could try and see if you can figure
it out by looking at the verbose output generated when compiling with
--enable-pool-debug=verbose.  With this option you can see when a pool
is created, cleared and/or destroyed, including information about the
parent pool, number of allocations and tag.

HTH,

Sander 

Mime
View raw message