apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <b...@wstoddard.com>
Subject Re: Win32 segfault in allocator code
Date Tue, 19 Mar 2002 04:43:12 GMT
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) {

???

Bill

Index: apr_pools.c
===================================================================
RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
retrieving revision 1.160
diff -u -r1.160 apr_pools.c
--- apr_pools.c 18 Mar 2002 15:01:42 -0000 1.160
+++ apr_pools.c 19 Mar 2002 04:37:00 -0000
@@ -668,7 +668,15 @@
             apr_thread_mutex_unlock(mutex);
 #endif /* APR_HAS_THREADS */
     }
-
+#if APR_HAS_THREADS
+    else {
+        /* This pools allocator mutex was cleaned up during run_cleanups()
+         * This hack will prevent apr_allocator_free from attempting to
+         * access the mutex
+         */
+        pool->allocator->mutex = NULL;
+     }
+#endif
     /* Find the block attached to the pool structure.  Save a copy of the
      * allocator pointer, because the pool struct soon will be no more.
      */

----- Original Message -----
From: "Bill Stoddard" <bill@wstoddard.com>
To: "APR Development List" <dev@apr.apache.org>
Sent: Monday, March 18, 2002 11:09 PM
Subject: Re: Win32 segfault in allocator code


> 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.
>
> Will post a patch later on unless someone beats me to it.
>
> Bill
>
> ----- Original Message -----
> From: "Bill Stoddard" <bill@wstoddard.com>
> To: "APR Development List" <dev@apr.apache.org>
> Sent: Monday, March 18, 2002 11:26 AM
> Subject: Win32 segfault in allocator code
>
>
> > I get this when I shutdown Apache 2 in Windows... (net stop apache2). I have not
had
> time
> > to spend debugging this one...
> >
> > NTDLL! 77f83941()
> > NTDLL! 77f838c6()
> > apr_allocator_free(apr_allocator_t * 0x00512768, apr_memnode_t * 0x00513fc8) line
322
> > apr_pool_destroy(apr_pool_t * 0x00513fd8) line 687
> > apr_pool_terminate() line 524
> > apr_terminate() line 237
> > destroy_and_exit_process(process_rec * 0x005180d8, int 0) line 242
> > main(int 4, const char * const * 0x005126f0) line 621 + 11 bytes
> > mainCRTStartup() line 338 + 17 bytes
> > KERNEL32! 77e8d326()
> >
>


Mime
View raw message