apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sander Striker" <stri...@apache.org>
Subject RE: Win32 segfault in allocator code
Date Tue, 19 Mar 2002 15:32:18 GMT
> From: Branko Cibej [mailto:brane@xbc.nu]
> Sent: 19 March 2002 16:14

> Sander Striker wrote:
> 
> >>From: Bill Stoddard [mailto:bill@wstoddard.com]
> >>Sent: 19 March 2002 05:43
> >>
> >
> >>>I'm pretty sure I have identified the problem on Windows.  The blow up happens
when we
> >>>are trying to obtain a mutex that has been freed. This happens on the very
last pool to be
> >>>cleaned up (the "global_pool"). In apr_pool_destroy, we call the pool cleanups
(one of
> >>>which is for the mutex in the allocator) then call apr_allocator_free() which
proceeds
> >>>to attempt to acquire the mutex that was just freed.
> >>>
> >
> >Oh, duh!  Why didn't I think of that?
> >Thanks for tracking this down Bill.
> >
> >
> >>This hack of a patch eliminates the seg fault.  I am not so familier with the
pool code and
> >>am not inclined to dig into it right now.  Perhaps the check to NULL out the
mutex should
> >>be
> >>
> >>if (apr_allocator_get_owner(allocator) == pool) {
> >>
> >>???
> >>
> >
> >Yes, that is the correct spot.  I've committed a patch similar to yours.
> >
> 
> That patch doesn't solve the problem. apr_terminate still crashes in the 
> pool cleanup.

Hmmm, reviewing the code again.  The patch is basically a noop, since
apr_allocator_destroy doesn't even use the lock.  Moving the code up
a few lines, as in my next commit, will fix it I think.

Thanks,

Sander


Mime
View raw message