Ivan Zhakov <i...@visualsvn.com> writes:

> On Wed, May 8, 2013 at 1:00 PM, Bert Huijben <b...@qqmail.nl> wrote:
>>
>> The fix resolves the symptoms, but I would guess it might be better
>> to make the thread create (and destroy) its own pool, while using
>> some proper iterpool in the function that creates the pools. Handing
>> a temporary pool to a new thread doesn't give us clean and easy to
>> maintain code... as this old bug shows us.
>>
> It would not for two reasons:
> 1. We allocate connection stream in connection_pool in main thread
> before creating worker thread
> 2. Current APR implementation requires that apr_thread_t * is
> available during thread lifetime. And we don't have any kind of
> notification when thread completes.

We could do this:

Index: subversion/svnserve/svnserve.c
===================================================================
--- subversion/svnserve/svnserve.c      (revision 1480565)
+++ subversion/svnserve/svnserve.c      (working copy)
@@ -444,6 +444,7 @@ int main(int argc, const char *argv[])
   apr_sockaddr_t *sa;
   apr_pool_t *pool;
   apr_pool_t *connection_pool;
+  apr_pool_t *iterpool;
   svn_error_t *err;
   apr_getopt_t *os;
   int opt;
@@ -973,6 +974,7 @@ int main(int argc, const char *argv[])
       {
 #if APR_HAS_THREADS
         settings.single_threaded = FALSE;
+        iterpool = svn_pool_create(pool);
 #else
         /* No requests will be processed at all
          * (see "switch (handling_mode)" code further down).
@@ -1093,7 +1095,7 @@ int main(int argc, const char *argv[])
              particularly sophisticated strategy for a threaded server, it's
              little different from forking one process per connection. */
 #if APR_HAS_THREADS
-          status = apr_threadattr_create(&tattr, connection_pool);
+          status = apr_threadattr_create(&tattr, iterpool);
           if (status)
             {
               err = svn_error_wrap_apr(status, _("Can't create threadattr"));
@@ -1122,6 +1124,7 @@ int main(int argc, const char *argv[])
               svn_error_clear(err);
               exit(1);
             }
+          svn_pool_clear(iterpool);
 #endif
           break;
 

-- 
Certified & Supported Apache Subversion Downloads:
http://www.wandisco.com/subversion/download

Reply via email to