[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Pools problems, fixed.

From: Branko Čibej <brane_at_xbc.nu>
Date: 2002-05-30 22:24:14 CEST

Sander Striker wrote:

>>From: Branko Cibej [mailto:brane@xbc.nu]
>>Sent: 30 May 2002 21:51
>>
>>
>
>
>
>>Sander Striker wrote:
>>
>>
>>
>>>Hi,
>>>
>>>A bunch of pools commits to APR later...
>>>
>>>Seriously, I think I have it fixed now. For both with APR_POOL_DEBUG
>>>and without. Please update your APR when compiling the HEAD of
>>>Subversion.
>>>
>>>Thanks,
>>>
>>>Sander
>>>
>>>
>>>
>>>
>>Well, the Windows build compiles without APR changes now, but the tests
>>still crash, albeit in a different place now (in apr_allocator_free).
>>This happens in both the release and debug builds, so it can't be
>>related to the pools debugging code.
>>
>>Unfortunately I don't have time to track this down. If somebody cares to
>>try, I'll cheer you on (a good place to start would be stringtest 13).
>>Otherwise I'll have a go on Monday.
>>
>>
>
>Ah, I know what it is.
>We need to register a simple cleanup:
>
>static apr_status_t svn_allocator_reset_mutex(void *allocator)
>{
> apr_allocator_mutex_set(allocator, NULL);
> return APR_SUCCESS;
>}
>
>This needs to be registered in svn_pool_create() in the block
>where there is no parent, and in svn_pool_clear() in the _p_p
>block.
>
>That will fix things (destroy currently kills the mutex, but apr_allocator_free
>still uses it after that... NULL'ing the mutex will help).
>
>I'll see if I can squeeze that in tomorrow. Others are ofcourse
>free to incorporate it.
>
>Sander
>
>
>

Like this (tests running, seems to work)?

Index: ./svn_error.c
===================================================================
--- ./svn_error.c
+++ ./svn_error.c 2002-05-30 22:19:35.000000000 +0200
@@ -400,6 +400,17 @@
 
 
 /*-----------------------------------------------------------------*/
+
+/* Cleanup function for pools.. */
+
+static apr_status_t
+allocator_reset_mutex (void *allocator)
+{
+ apr_allocator_mutex_set(allocator, NULL);
+ return APR_SUCCESS;
+}
+
+
 /*
    Macros to make the preprocessor logic less confusing.
    We need to always have svn_pool_xxx aswell as
@@ -459,6 +470,8 @@
           abort_on_pool_failure (apr_err);
 
         apr_allocator_mutex_set (allocator, mutex);
+ apr_pool_cleanup_register (ret_pool, allocator,
+ allocator_reset_mutex, NULL);
       }
 #endif /* APR_HAS_THREADS */
 
@@ -517,6 +530,8 @@
       apr_allocator_mutex_set (allocator, NULL);
       (void) apr_thread_mutex_create (&mutex, APR_THREAD_MUTEX_DEFAULT, pool);
       apr_allocator_mutex_set (allocator, mutex);
+ apr_pool_cleanup_register (pool, allocator,
+ allocator_reset_mutex, NULL);
 #endif /* APR_HAS_THREADS */
         
       /* Here we have a problematic situation. We cleared the pool P,

-- 
Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jun 1 14:16:31 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.