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

Re: [BUG] Mutex is destroyed when clearing top level pool, WAS: RE: svn commit: rev 2017 - trunk/subversion/libsvn_subr

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2002-05-29 16:04:11 CEST

"Sander Striker" <striker@apache.org> writes:

> Hmmm, well, it _is_ evening now, but I don't really have the energy
> to patch it up. If someone beats me to it, fine, otherwise just don't
> run with apr pool debugging enabled for now.

I'm using a patch that puts the mutex into the parent's pool. This
allows APR_POOL_DEBUG to be used with Subversion. It's not a perfect
solution due to the potential for unbounded memory use. It's good
enough for me...

Index: memory/unix/apr_pools.c
===================================================================
RCS file: /home/cvspublic/apr/memory/unix/apr_pools.c,v
retrieving revision 1.169
diff -u -r1.169 apr_pools.c
--- memory/unix/apr_pools.c 26 May 2002 09:00:08 -0000 1.169
+++ memory/unix/apr_pools.c 29 May 2002 13:56:07 -0000
@@ -1409,6 +1409,7 @@
 #if APR_HAS_THREADS
         if (mutex)
             apr_thread_mutex_unlock(mutex);
+ apr_thread_mutex_destroy(mutex);
 #endif /* APR_HAS_THREADS */
     }
 
@@ -1494,9 +1495,14 @@
          * the pool having no lock). However, this might actually
          * hide problems like creating a child pool of a pool
          * belonging to another thread.
+ *
+ * PROBLEM: allocating in parent pool causes potentially unbounded
+ * memory usage.
          */
- if ((rv = apr_thread_mutex_create(&pool->mutex,
- APR_THREAD_MUTEX_NESTED, pool)) != APR_SUCCESS) {
+ rv = apr_thread_mutex_create(&pool->mutex,
+ APR_THREAD_MUTEX_NESTED,
+ pool->parent ? pool->parent : pool);
+ if (rv != APR_SUCCESS) {
             free(pool);
             return rv;
         }

-- 
Philip
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed May 29 16:05:15 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.