subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1659010 - /subversion/trunk/subversion/tests/libsvn_ra/ra-test.c
Date Wed, 11 Feb 2015 17:15:49 GMT
Author: brane
Date: Wed Feb 11 17:15:49 2015
New Revision: 1659010

URL: http://svn.apache.org/r1659010
Log:
Fix a race in ra-test that could cause a deadlock in BDB cleanup.

* subversion/tests/libsvn_ra/ra-test.c
  (close_baton_t): Remember the handle of the child svnserver process.
  (open_tunnel): Set subprocess state o APR_KILL_NEVER, regardless of
   platform, so that pool cleanup cannot interact with normal
   subprocess termination. Remember the process handle in the
   close-tunnel baton.
  (close_tunnel): Kill the child svnserve process.

Modified:
    subversion/trunk/subversion/tests/libsvn_ra/ra-test.c

Modified: subversion/trunk/subversion/tests/libsvn_ra/ra-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_ra/ra-test.c?rev=1659010&r1=1659009&r2=1659010&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_ra/ra-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_ra/ra-test.c Wed Feb 11 17:15:49 2015
@@ -151,6 +151,7 @@ typedef struct close_baton_t
 {
   int magic;
   tunnel_baton_t *tb;
+  apr_proc_t *proc;
 } close_baton_t;
 
 #define CLOSE_MAGIC 0x1BADBAD1
@@ -212,11 +213,7 @@ open_tunnel(svn_stream_t **request, svn_
                              args, NULL, attr, pool);
   if (status != APR_SUCCESS)
     return svn_error_wrap_apr(status, "Could not run svnserve");
-#ifdef WIN32
   apr_pool_note_subprocess(pool, proc, APR_KILL_NEVER);
-#else
-  apr_pool_note_subprocess(pool, proc, APR_KILL_ONLY_ONCE);
-#endif
 
   /* APR pipe objects inherit by default.  But we don't want the
    * tunnel agent's pipes held open by future child processes
@@ -227,6 +224,7 @@ open_tunnel(svn_stream_t **request, svn_
   cb = apr_pcalloc(pool, sizeof(*cb));
   cb->magic = CLOSE_MAGIC;
   cb->tb = b;
+  cb->proc = proc;
 
   *request = svn_stream_from_aprfile2(proc->in, FALSE, pool);
   *response = svn_stream_from_aprfile2(proc->out, FALSE, pool);
@@ -243,7 +241,8 @@ close_tunnel(void *tunnel_context, void
 
   if (b->magic != CLOSE_MAGIC)
     abort();
-  --b->tb->open_count;
+  if (--b->tb->open_count == 0)
+    apr_proc_kill(b->proc, SIGTERM);
 }
 
 



Mime
View raw message