You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Josh Pieper <jp...@andrew.cmu.edu> on 2003/10/05 16:51:50 UTC

[PATCH] decrease maximum simultaneous svn:externals connections (issue #1448)

Here's another bite-sized patch.  By moving where the sub-pools are
allocated, the maximum number of simultaneous svn:externals
connections is now a function of the recursion depth, rather than the
total number of linked repositories in the tree.  I'm not certain that
this is correct pool usage, as I haven't used apr's pools before.
However, it doesn't segfault or leak more memory, and it passes all
local tests.

-Josh

-------------------------------------

Fix issue #1448: Decrease the number of svn:externals connections
by clearing appropriate subpools after each external operation.

* subversion/libsvn_client/externals.c
  (handle_externals_desc_change, handle_external_item_change):
    Create a subpool for each external that is handled and destroy
    it upon completion.
  (svn_client__do_external_status): Move the created subpool in one
    level, so that it is cleared after each external is checked.


Index: subversion/libsvn_client/externals.c
===================================================================
--- subversion/libsvn_client/externals.c	(revision 7308)
+++ subversion/libsvn_client/externals.c	(working copy)
@@ -383,6 +383,7 @@
         }
     }
 
+  svn_pool_clear(ib->pool);
   return SVN_NO_ERROR;
 }
 
@@ -434,11 +435,13 @@
   ib.ctx               = cb->ctx;
   ib.update_unchanged  = cb->update_unchanged;
   ib.timestamp_sleep   = cb->timestamp_sleep;
-  ib.pool              = cb->pool;
+  ib.pool              = svn_pool_create(cb->pool);
 
   SVN_ERR (svn_hash_diff (old_desc, new_desc,
                           handle_external_item_change, &ib, cb->pool));
 
+  svn_pool_destroy(ib.pool);
+
   return SVN_NO_ERROR;
 }
 
@@ -481,7 +484,6 @@
 {
   apr_hash_t *externals_old, *externals_new;
   apr_hash_index_t *hi;
-  apr_pool_t *subpool = svn_pool_create (pool);
 
   /* Get the values of the svn:externals properties. */
   svn_wc_edited_externals (&externals_old, &externals_new, traversal_info);
@@ -493,6 +495,7 @@
        hi; 
        hi = apr_hash_next (hi))
     {
+      apr_pool_t *subpool = svn_pool_create (pool);
       apr_hash_t *exts;
       apr_hash_index_t *hi2;
       const void *key;
@@ -500,9 +503,6 @@
       const char *path;
       const char *propval;
 
-      /* Clear the subpool. */
-      svn_pool_clear (subpool);
-
       apr_hash_this (hi, &key, NULL, &val);
       path = key;
       propval = val;
@@ -510,10 +510,10 @@
       /* Parse the svn:externals property value.  This results in a
          hash mapping subdirectories to externals structures. */
       SVN_ERR (svn_wc_parse_externals_description (&exts, path, 
-                                                   propval, subpool));
-
+                                                   propval, pool));
+      
       /* Loop over the subdir hash. */
-      for (hi2 = apr_hash_first (subpool, exts); 
+      for (hi2 = apr_hash_first (pool, exts); 
            hi2; 
            hi2 = apr_hash_next (hi2))
         {
@@ -548,10 +548,13 @@
                                       &(external->revision),
                                       status_func, status_baton, 
                                       TRUE, get_all, update, no_ignore, 
-                                      ctx, pool));
+                                      ctx, subpool));
+
+          svn_pool_clear (subpool);
         }
-    } 
+      
+      svn_pool_destroy (subpool);
+    }
   
-  apr_pool_destroy (subpool);
   return SVN_NO_ERROR;
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] decrease maximum simultaneous svn:externals connections (issue #1448)

Posted by "C. Michael Pilato" <cm...@collab.net>.
Josh Pieper <jp...@andrew.cmu.edu> writes:

> > Sheesh.  Um... I don't know how small a task it is, but would you mind
> > taking a look at issue #1534?  It will probably take you on a tour
> > through the whole of Subversion, but if you're not opposed to that
> > (and I'm hoping your eagerness is an indication of exactly that),
> > rock!
> 
> I didn't look at it before because of the hinted need for
> "refactoring".  However, I'm becoming a bit more familiar with the svn
> codebase so I'll see what I can do.

Sweet.  If you want instead to take a look at finishing off the issue
we both started (see comments in the issue itself), that's cool, too.
Just make a note in the issue stating such.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] decrease maximum simultaneous svn:externals connections (issue #1448)

Posted by Josh Pieper <jp...@andrew.cmu.edu>.
> Sheesh.  Um... I don't know how small a task it is, but would you mind
> taking a look at issue #1534?  It will probably take you on a tour
> through the whole of Subversion, but if you're not opposed to that
> (and I'm hoping your eagerness is an indication of exactly that),
> rock!

I didn't look at it before because of the hinted need for
"refactoring".  However, I'm becoming a bit more familiar with the svn
codebase so I'll see what I can do.

-Josh

-- 
If God had intended Man to Walk, He would have given him Feet.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] decrease maximum simultaneous svn:externals connections (issue #1448)

Posted by "C. Michael Pilato" <cm...@collab.net>.
Josh Pieper <jp...@andrew.cmu.edu> writes:

> > Dude!
> > 
> > Allow me to copy-n-paste my current log-message-in-progress:
> > 
> >    Finish issue #1448 - svn:externals keeps connections open until end.
> >    
> >    * subversion/libsvn_client/externals.c
> >      (struct handle_external_item_change_baton): Declare the 'pool'
> >        member to be for short-lived scratchwork only.
> >      (handle_external_item_change): Clear the baton's pool before using it. 
> >      (handle_externals_desc_change): Allocate and destroy a subpool for
> >        the hash diff mechanism.
> >      (svn_client__do_external_status): Um... do the status in the
> >        subpool, too.
> > 
> > Get outta my brain, boy!  :-)
> 
> To stem the risk of further brain violation, have any small things
> that need to be done that won't get in your way?

Sheesh.  Um... I don't know how small a task it is, but would you mind
taking a look at issue #1534?  It will probably take you on a tour
through the whole of Subversion, but if you're not opposed to that
(and I'm hoping your eagerness is an indication of exactly that),
rock!

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] decrease maximum simultaneous svn:externals connections (issue #1448)

Posted by Josh Pieper <jp...@andrew.cmu.edu>.
> Dude!
> 
> Allow me to copy-n-paste my current log-message-in-progress:
> 
>    Finish issue #1448 - svn:externals keeps connections open until end.
>    
>    * subversion/libsvn_client/externals.c
>      (struct handle_external_item_change_baton): Declare the 'pool'
>        member to be for short-lived scratchwork only.
>      (handle_external_item_change): Clear the baton's pool before using it. 
>      (handle_externals_desc_change): Allocate and destroy a subpool for
>        the hash diff mechanism.
>      (svn_client__do_external_status): Um... do the status in the
>        subpool, too.
> 
> Get outta my brain, boy!  :-)

To stem the risk of further brain violation, have any small things
that need to be done that won't get in your way?

-Josh


-- 
Virtue would go far if vanity did not keep it company.
		-- La Rochefoucauld

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] decrease maximum simultaneous svn:externals connections (issue #1448)

Posted by "C. Michael Pilato" <cm...@collab.net>.
Josh Pieper <jp...@andrew.cmu.edu> writes:

> Here's another bite-sized patch.  By moving where the sub-pools are
> allocated, the maximum number of simultaneous svn:externals
> connections is now a function of the recursion depth, rather than the
> total number of linked repositories in the tree.  I'm not certain that
> this is correct pool usage, as I haven't used apr's pools before.
> However, it doesn't segfault or leak more memory, and it passes all
> local tests.
> 
> -Josh
> 
> -------------------------------------
> 
> Fix issue #1448: Decrease the number of svn:externals connections
> by clearing appropriate subpools after each external operation.
> 
> * subversion/libsvn_client/externals.c
>   (handle_externals_desc_change, handle_external_item_change):
>     Create a subpool for each external that is handled and destroy
>     it upon completion.
>   (svn_client__do_external_status): Move the created subpool in one
>     level, so that it is cleared after each external is checked.

Dude!

Allow me to copy-n-paste my current log-message-in-progress:

   Finish issue #1448 - svn:externals keeps connections open until end.
   
   * subversion/libsvn_client/externals.c
     (struct handle_external_item_change_baton): Declare the 'pool'
       member to be for short-lived scratchwork only.
     (handle_external_item_change): Clear the baton's pool before using it. 
     (handle_externals_desc_change): Allocate and destroy a subpool for
       the hash diff mechanism.
     (svn_client__do_external_status): Um... do the status in the
       subpool, too.

Get outta my brain, boy!  :-)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org