apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sander Striker" <stri...@apache.org>
Subject RE: Creating an allocator with no mutex...
Date Fri, 18 Jul 2003 21:20:38 GMT
> From: Brad Nicholes [mailto:BNICHOLES@novell.com]
> Sent: Friday, July 18, 2003 10:23 PM

Hi,

> I think we just discovered what the real source of the problem is.  It
> appears that apr_pool_create_ex() is trying to extract the mutex from
> the wrong allocator when an allocator is specified.  When it tries to
> get the mutex it uses the parent allocator if one was not passed in.  If
> an allocator was passed in then it uses that one instead which is wrong.
>  The mutex from the allocator that was passed in does not protect the
> parent but the code still manipulates it anyway.  This means that two or
> more threads could overwrite parent->child simply because the wrong
> mutex was locked or no mutex was locked at all (in our case).  The call
> to apr_allocator_mutex_get() should use "parent->allocator" not
> "allocator".  If you look at apr_pool_destroy() it is doing it
> correctly.  Otherwise this code is not thread safe.

Spot on Brad!  I'll commit the fix ASAP.


Sander

Mime
View raw message