You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Lieven Govaerts <sv...@mobsol.be> on 2011/07/22 10:16:07 UTC

[BUG] svnsync segfault

Hi,

when syncing the first ~200 revisions from the asf repository over
ra_serf to ra_local, svnsync segfaults when invoking the
pre-revprop-change hook of the local target repo.

Not really at home in this part of the code, so if anyone can point me
in the right direction that would be appreciated.

Lieven


#0  0x00000001006b7d04 in apr_file_name_get ()
#1  0x000000010051ce29 in stringbuf_from_aprfile
(result=0x7fff5fbfe7b0, filename=0x0, file=0x0, check_size=1,
pool=0x104541028) at subversion/libsvn_subr/io.c:2027
#2  0x000000010051d18a in svn_stringbuf_from_aprfile
(result=0x7fff5fbfe7b0, file=0x0, pool=0x104541028) at
subversion/libsvn_subr/io.c:2106
#3  0x000000010003bfc4 in check_hook_result (name=0x100054eaa
"pre-revprop-change", cmd=0x104541438
"/tmp/asfrepo/hooks/pre-revprop-change", cmd_proc=0x7fff5fbfe860,
read_errhandle=0x0, pool=0x104541028) at
subversion/libsvn_repos/hooks.c:71
#4  0x000000010003c47f in run_hook_cmd (result=0x0, name=0x100054eaa
"pre-revprop-change", cmd=0x104541438
"/tmp/asfrepo/hooks/pre-revprop-change", args=0x7fff5fbfe900,
stdin_handle=0x104541548, pool=0x104541028) at
subversion/libsvn_repos/hooks.c:210
#5  0x000000010003d057 in svn_repos__hooks_pre_revprop_change
(repos=0x10107e590, rev=199, author=0x101095c08 "lgo",
name=0x1044e61d8 "svn:author", new_value=0x104555040, action=77 'M',
pool=0x104541028) at subversion/libsvn_repos/hooks.c:516
#6  0x000000010003aecf in svn_repos_fs_change_rev_prop4
(repos=0x10107e590, rev=199, author=0x101095c08 "lgo",
name=0x1044e61d8 "svn:author", old_value_p=0x0, new_value=0x104555040,
use_pre_revprop_change_hook=1, use_post_revprop_change_hook=1,
authz_read_func=0, authz_read_baton=0x0, pool=0x104541028) at
subversion/libsvn_repos/fs-wrap.c:352
#7  0x000000010002350a in svn_ra_local__change_rev_prop
(session=0x10107e4c8, rev=199, name=0x1044e61d8 "svn:author",
old_value_p=0x0, value=0x104555040, pool=0x104541028) at
subversion/libsvn_ra_local/ra_plugin.c:587
#8  0x00000001000164b8 in svn_ra_change_rev_prop2
(session=0x10107e4c8, rev=199, name=0x1044e61d8 "svn:author",
old_value_p=0x0, value=0x104555040, pool=0x104541028) at
subversion/libsvn_ra/ra_loader.c:661
#9  0x000000010000162b in write_revprops
(filtered_count=0x7fff5fbfec5c, session=0x10107e4c8, rev=199,
rev_props=0x10454a438, pool=0x10454a028) at
subversion/svnsync/main.c:569
#10 0x0000000100002f93 in replay_rev_finished (revision=199,
replay_baton=0x10282b5f0, editor=0x103bda7a0, edit_baton=0x103bda820,
rev_props=0x1044e60a0, pool=0x1044e6028) at
subversion/svnsync/main.c:1168
#11 0x0000000100168abf in end_replay (parser=0x103d77a38,
userData=0x103d776a0, name={namespace = 0x103d716c0 "svn:", name =
0x1009042e2 "editor-report"}) at
subversion/libsvn_ra_serf/replay.c:489

Re: [BUG] svnsync segfault

Posted by Lieven Govaerts <sv...@mobsol.be>.
On Fri, Jul 22, 2011 at 10:54 AM, Philip Martin
<ph...@wandisco.com> wrote:
> Lieven Govaerts <sv...@mobsol.be> writes:
>
>> when syncing the first ~200 revisions from the asf repository over
>> ra_serf to ra_local, svnsync segfaults when invoking the
>> pre-revprop-change hook of the local target repo.
>>
>> Not really at home in this part of the code, so if anyone can point me
>> in the right direction that would be appreciated.
>
> Does it happen on the first revision?  At random?
>
On my mac usually after 200 revisions or so. Daniel's patch suggests a
link between this number and the max. amount of open file handles,
which is:
lgo-macbp:trunk lgo$ ulimit -n
256

Lieven

>> #0  0x00000001006b7d04 in apr_file_name_get ()
>
> Either it's an APR bug (not initialising fname) or we passed an invalid
> apr_file_t file handle.
>
>> #1  0x000000010051ce29 in stringbuf_from_aprfile
>> (result=0x7fff5fbfe7b0, filename=0x0, file=0x0, check_size=1,
>> pool=0x104541028) at subversion/libsvn_subr/io.c:2027
>> #2  0x000000010051d18a in svn_stringbuf_from_aprfile
>> (result=0x7fff5fbfe7b0, file=0x0, pool=0x104541028) at
>> subversion/libsvn_subr/io.c:2106
>> #3  0x000000010003bfc4 in check_hook_result (name=0x100054eaa
>> "pre-revprop-change", cmd=0x104541438
>> "/tmp/asfrepo/hooks/pre-revprop-change", cmd_proc=0x7fff5fbfe860,
>> read_errhandle=0x0, pool=0x104541028) at
>> subversion/libsvn_repos/hooks.c:71
>> #4  0x000000010003c47f in run_hook_cmd (result=0x0, name=0x100054eaa
>> "pre-revprop-change", cmd=0x104541438
>> "/tmp/asfrepo/hooks/pre-revprop-change", args=0x7fff5fbfe900,
>> stdin_handle=0x104541548, pool=0x104541028) at
>> subversion/libsvn_repos/hooks.c:210
>
> Here run_hook_cmd has called svn_io_start_cmd2 and it did not return an
> error, so it should have set cmd_proc.err to a valid apr_file_t.
>
>> #5  0x000000010003d057 in svn_repos__hooks_pre_revprop_change
>> (repos=0x10107e590, rev=199, author=0x101095c08 "lgo",
>> name=0x1044e61d8 "svn:author", new_value=0x104555040, action=77 'M',
>> pool=0x104541028) at subversion/libsvn_repos/hooks.c:516
>
> --
> uberSVN: Apache Subversion Made Easy
> http://www.uberSVN.com
>

Re: [BUG] svnsync segfault

Posted by Philip Martin <ph...@wandisco.com>.
Lieven Govaerts <sv...@mobsol.be> writes:

> when syncing the first ~200 revisions from the asf repository over
> ra_serf to ra_local, svnsync segfaults when invoking the
> pre-revprop-change hook of the local target repo.
> 
> Not really at home in this part of the code, so if anyone can point me
> in the right direction that would be appreciated.

Does it happen on the first revision?  At random?

> #0  0x00000001006b7d04 in apr_file_name_get ()

Either it's an APR bug (not initialising fname) or we passed an invalid
apr_file_t file handle.

> #1  0x000000010051ce29 in stringbuf_from_aprfile
> (result=0x7fff5fbfe7b0, filename=0x0, file=0x0, check_size=1,
> pool=0x104541028) at subversion/libsvn_subr/io.c:2027
> #2  0x000000010051d18a in svn_stringbuf_from_aprfile
> (result=0x7fff5fbfe7b0, file=0x0, pool=0x104541028) at
> subversion/libsvn_subr/io.c:2106
> #3  0x000000010003bfc4 in check_hook_result (name=0x100054eaa
> "pre-revprop-change", cmd=0x104541438
> "/tmp/asfrepo/hooks/pre-revprop-change", cmd_proc=0x7fff5fbfe860,
> read_errhandle=0x0, pool=0x104541028) at
> subversion/libsvn_repos/hooks.c:71
> #4  0x000000010003c47f in run_hook_cmd (result=0x0, name=0x100054eaa
> "pre-revprop-change", cmd=0x104541438
> "/tmp/asfrepo/hooks/pre-revprop-change", args=0x7fff5fbfe900,
> stdin_handle=0x104541548, pool=0x104541028) at
> subversion/libsvn_repos/hooks.c:210

Here run_hook_cmd has called svn_io_start_cmd2 and it did not return an
error, so it should have set cmd_proc.err to a valid apr_file_t.

> #5  0x000000010003d057 in svn_repos__hooks_pre_revprop_change
> (repos=0x10107e590, rev=199, author=0x101095c08 "lgo",
> name=0x1044e61d8 "svn:author", new_value=0x104555040, action=77 'M',
> pool=0x104541028) at subversion/libsvn_repos/hooks.c:516

-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com

Re: [BUG] svnsync segfault

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Forgot to say: there appears to be a file descriptor leak when syncing
serf->local (but not with serf->svn), and eg setting 'ulimit -n 20'
shortens the wait time until the bug triggers.

Daniel Shahaf wrote on Fri, Jul 22, 2011 at 11:33:45 +0300:
> Greg pointed that earlier on IRC.  I'm so far at:
> 
> [[[
> Index: subversion/libsvn_subr/io.c
> ===================================================================
> --- subversion/libsvn_subr/io.c	(revision 1149353)
> +++ subversion/libsvn_subr/io.c	(working copy)
> @@ -2393,6 +2393,8 @@ handle_child_process_error(apr_pool_t *pool, apr_s
>    apr_file_t *errfile;
>    void *p;
>  
> +  SVN_DBG(("At handle_child_process_error(): got %ld, %s\n", (long)status, desc));
> +
>    /* We can't do anything if we get an error here, so just return. */
>    if (apr_pool_userdata_get(&p, ERRFILE_KEY, pool))
>      return;
> @@ -2489,10 +2491,16 @@ svn_io_start_cmd2(apr_proc_t *cmd_proc,
>  
>    /* Forward request for pipes to APR. */
>    if (infile_pipe || outfile_pipe || errfile_pipe)
> -    apr_procattr_io_set(cmdproc_attr,
> -                        infile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
> -                        outfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
> -                        errfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE);
> +    {
> +      apr_err = apr_procattr_io_set(cmdproc_attr,
> +                                    infile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
> +                                    outfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
> +                                    errfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE);
> +      if (apr_err)
> +        return svn_error_wrap_apr(apr_err,
> +                                  _("Can't set process '%s' stdio pipes"),
> +                                  cmd);
> +    }
>  
>    /* Have the child print any problems executing its program to errfile. */
>    apr_err = apr_pool_userdata_set(errfile, ERRFILE_KEY, NULL, pool);
> ]]]
> 
> but with this applied I get some further segfaults --- apr_file_t.pool
> appears to be invalid.
> 
> [[[
> Copied properties for revision 10.
> ==14435== Warning: invalid file descriptor -1 in syscall close()
> Transmitting file data ..
> Committed revision 11.
> ==14350== Warning: invalid file descriptor 25 in syscall pipe()
> ==14350== Use of uninitialised value of size 4
> ==14350==    at 0x40B6A93: apr_file_close (open.c:233)
> ==14350==    by 0x4280DEE: run_hook_cmd (hooks.c:216)
> ==14350==    by 0x42819AB: svn_repos__hooks_pre_revprop_change (hooks.c:516)
> ==14350==    by 0x427F832: svn_repos_fs_change_rev_prop4 (fs-wrap.c:352)
> ==14350==    by 0x4268281: svn_ra_local__change_rev_prop (ra_plugin.c:587)
> ==14350==    by 0x40302D2: svn_ra_change_rev_prop2 (ra_loader.c:661)
> ==14350==    by 0x804A52D: write_revprops (main.c:569)
> ==14350==    by 0x804BD92: replay_rev_finished (main.c:1168)
> ==14350==    by 0x430280B: end_replay (replay.c:489)
> ==14350==    by 0x430ED69: end_xml (util.c:1280)
> ==14350==    by 0x4352A54: ??? (in /usr/lib/libexpat.so.1.5.2)
> ==14350==    by 0x43538A0: ??? (in /usr/lib/libexpat.so.1.5.2)
> ]]]
> 
> 
> Lieven Govaerts wrote on Fri, Jul 22, 2011 at 10:16:07 +0200:
> > Hi,
> > 
> > when syncing the first ~200 revisions from the asf repository over
> > ra_serf to ra_local, svnsync segfaults when invoking the
> > pre-revprop-change hook of the local target repo.
> > 
> > Not really at home in this part of the code, so if anyone can point me
> > in the right direction that would be appreciated.
> > 
> > Lieven
> > 
> > 
> > #0  0x00000001006b7d04 in apr_file_name_get ()
> > #1  0x000000010051ce29 in stringbuf_from_aprfile
> > (result=0x7fff5fbfe7b0, filename=0x0, file=0x0, check_size=1,
> > pool=0x104541028) at subversion/libsvn_subr/io.c:2027
> > #2  0x000000010051d18a in svn_stringbuf_from_aprfile
> > (result=0x7fff5fbfe7b0, file=0x0, pool=0x104541028) at
> > subversion/libsvn_subr/io.c:2106
> > #3  0x000000010003bfc4 in check_hook_result (name=0x100054eaa
> > "pre-revprop-change", cmd=0x104541438
> > "/tmp/asfrepo/hooks/pre-revprop-change", cmd_proc=0x7fff5fbfe860,
> > read_errhandle=0x0, pool=0x104541028) at
> > subversion/libsvn_repos/hooks.c:71
> > #4  0x000000010003c47f in run_hook_cmd (result=0x0, name=0x100054eaa
> > "pre-revprop-change", cmd=0x104541438
> > "/tmp/asfrepo/hooks/pre-revprop-change", args=0x7fff5fbfe900,
> > stdin_handle=0x104541548, pool=0x104541028) at
> > subversion/libsvn_repos/hooks.c:210
> > #5  0x000000010003d057 in svn_repos__hooks_pre_revprop_change
> > (repos=0x10107e590, rev=199, author=0x101095c08 "lgo",
> > name=0x1044e61d8 "svn:author", new_value=0x104555040, action=77 'M',
> > pool=0x104541028) at subversion/libsvn_repos/hooks.c:516
> > #6  0x000000010003aecf in svn_repos_fs_change_rev_prop4
> > (repos=0x10107e590, rev=199, author=0x101095c08 "lgo",
> > name=0x1044e61d8 "svn:author", old_value_p=0x0, new_value=0x104555040,
> > use_pre_revprop_change_hook=1, use_post_revprop_change_hook=1,
> > authz_read_func=0, authz_read_baton=0x0, pool=0x104541028) at
> > subversion/libsvn_repos/fs-wrap.c:352
> > #7  0x000000010002350a in svn_ra_local__change_rev_prop
> > (session=0x10107e4c8, rev=199, name=0x1044e61d8 "svn:author",
> > old_value_p=0x0, value=0x104555040, pool=0x104541028) at
> > subversion/libsvn_ra_local/ra_plugin.c:587
> > #8  0x00000001000164b8 in svn_ra_change_rev_prop2
> > (session=0x10107e4c8, rev=199, name=0x1044e61d8 "svn:author",
> > old_value_p=0x0, value=0x104555040, pool=0x104541028) at
> > subversion/libsvn_ra/ra_loader.c:661
> > #9  0x000000010000162b in write_revprops
> > (filtered_count=0x7fff5fbfec5c, session=0x10107e4c8, rev=199,
> > rev_props=0x10454a438, pool=0x10454a028) at
> > subversion/svnsync/main.c:569
> > #10 0x0000000100002f93 in replay_rev_finished (revision=199,
> > replay_baton=0x10282b5f0, editor=0x103bda7a0, edit_baton=0x103bda820,
> > rev_props=0x1044e60a0, pool=0x1044e6028) at
> > subversion/svnsync/main.c:1168
> > #11 0x0000000100168abf in end_replay (parser=0x103d77a38,
> > userData=0x103d776a0, name={namespace = 0x103d716c0 "svn:", name =
> > 0x1009042e2 "editor-report"}) at
> > subversion/libsvn_ra_serf/replay.c:489

Re: [BUG] svnsync segfault

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Daniel Shahaf wrote on Fri, Jul 22, 2011 at 11:33:45 +0300:
> Greg pointed that earlier on IRC.  I'm so far at:
> 


Updated patch:

[[[
Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c	(revision 1149353)
+++ subversion/libsvn_subr/io.c	(working copy)
@@ -2489,10 +2491,17 @@ svn_io_start_cmd2(apr_proc_t *cmd_proc,
 
   /* Forward request for pipes to APR. */
   if (infile_pipe || outfile_pipe || errfile_pipe)
-    apr_procattr_io_set(cmdproc_attr,
-                        infile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
-                        outfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
-                        errfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE);
+    {
+      apr_err = apr_procattr_io_set(cmdproc_attr,
+                                    infile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
+                                    outfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
+                                    errfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE);
+
+      if (apr_err)
+        return svn_error_wrap_apr(apr_err,
+                                  _("Can't set process '%s' stdio pipes"),
+                                  cmd);
+    }
 
   /* Have the child print any problems executing its program to errfile. */
   apr_err = apr_pool_userdata_set(errfile, ERRFILE_KEY, NULL, pool);
Index: subversion/libsvn_repos/hooks.c
===================================================================
--- subversion/libsvn_repos/hooks.c	(revision 1149353)
+++ subversion/libsvn_repos/hooks.c	(working copy)
@@ -202,7 +202,8 @@ run_hook_cmd(svn_string_t **result,
 
   if (err)
     {
-      err = svn_error_createf
+      /* CMD_PROC is not safe to use. Bail. */
+      return svn_error_createf
         (SVN_ERR_REPOS_HOOK_FAILURE, err, _("Failed to start '%s' hook"), cmd);
     }
   else
]]]

(ie, theory is that the local variable CMD_PROC was used uninitialized)


Generates this error chain:
[[[
subversion/svnsync/main.c:1382: (apr_err=165001)
subversion/svnsync/main.c:1328: (apr_err=165001)
subversion/libsvn_ra_serf/replay.c:874: (apr_err=165001)
subversion/libsvn_ra_serf/util.c:2049: (apr_err=165001)
subversion/libsvn_ra_serf/util.c:2049: (apr_err=165001)
subversion/libsvn_ra_serf/util.c:1790: (apr_err=165001)
subversion/libsvn_ra_serf/util.c:1492: (apr_err=165001)
subversion/libsvn_ra_serf/replay.c:492: (apr_err=165001)
subversion/svnsync/main.c:1169: (apr_err=165001)
subversion/svnsync/main.c:570: (apr_err=165001)
subversion/libsvn_repos/fs-wrap.c:353: (apr_err=165001)
subversion/libsvn_repos/hooks.c:518: (apr_err=165001)
subversion/libsvn_repos/hooks.c:206: (apr_err=165001)
svnsync: E165001: Failed to start '/tmp/svn/r1/hooks/pre-revprop-change' hook
subversion/libsvn_subr/io.c:2502: (apr_err=24)
svnsync: E000024: Can't set process '/tmp/svn/r1/hooks/pre-revprop-change' stdio pipes: Too many open files
subversion/libsvn_ra/util.c:108: (apr_err=165001)
subversion/libsvn_repos/fs-wrap.c:353: (apr_err=165001)
subversion/libsvn_repos/hooks.c:518: (apr_err=165001)
subversion/libsvn_repos/hooks.c:206: (apr_err=165001)
svnsync: E165001: Failed to start '/tmp/svn/r1/hooks/pre-revprop-change' hook
subversion/libsvn_subr/io.c:2502: (apr_err=24)
svnsync: E000024: Can't set process '/tmp/svn/r1/hooks/pre-revprop-change' stdio pipes: Too many open files

Program exited with code 01.
]]]

> 
> Lieven Govaerts wrote on Fri, Jul 22, 2011 at 10:16:07 +0200:
> > Hi,
> > 
> > when syncing the first ~200 revisions from the asf repository over
> > ra_serf to ra_local, svnsync segfaults when invoking the
> > pre-revprop-change hook of the local target repo.
> > 
> > Not really at home in this part of the code, so if anyone can point me
> > in the right direction that would be appreciated.
> > 
> > Lieven
> > 
> > 
> > #0  0x00000001006b7d04 in apr_file_name_get ()
> > #1  0x000000010051ce29 in stringbuf_from_aprfile
> > (result=0x7fff5fbfe7b0, filename=0x0, file=0x0, check_size=1,
> > pool=0x104541028) at subversion/libsvn_subr/io.c:2027
> > #2  0x000000010051d18a in svn_stringbuf_from_aprfile
> > (result=0x7fff5fbfe7b0, file=0x0, pool=0x104541028) at
> > subversion/libsvn_subr/io.c:2106
> > #3  0x000000010003bfc4 in check_hook_result (name=0x100054eaa
> > "pre-revprop-change", cmd=0x104541438
> > "/tmp/asfrepo/hooks/pre-revprop-change", cmd_proc=0x7fff5fbfe860,
> > read_errhandle=0x0, pool=0x104541028) at
> > subversion/libsvn_repos/hooks.c:71
> > #4  0x000000010003c47f in run_hook_cmd (result=0x0, name=0x100054eaa
> > "pre-revprop-change", cmd=0x104541438
> > "/tmp/asfrepo/hooks/pre-revprop-change", args=0x7fff5fbfe900,
> > stdin_handle=0x104541548, pool=0x104541028) at
> > subversion/libsvn_repos/hooks.c:210
> > #5  0x000000010003d057 in svn_repos__hooks_pre_revprop_change
> > (repos=0x10107e590, rev=199, author=0x101095c08 "lgo",
> > name=0x1044e61d8 "svn:author", new_value=0x104555040, action=77 'M',
> > pool=0x104541028) at subversion/libsvn_repos/hooks.c:516
> > #6  0x000000010003aecf in svn_repos_fs_change_rev_prop4
> > (repos=0x10107e590, rev=199, author=0x101095c08 "lgo",
> > name=0x1044e61d8 "svn:author", old_value_p=0x0, new_value=0x104555040,
> > use_pre_revprop_change_hook=1, use_post_revprop_change_hook=1,
> > authz_read_func=0, authz_read_baton=0x0, pool=0x104541028) at
> > subversion/libsvn_repos/fs-wrap.c:352
> > #7  0x000000010002350a in svn_ra_local__change_rev_prop
> > (session=0x10107e4c8, rev=199, name=0x1044e61d8 "svn:author",
> > old_value_p=0x0, value=0x104555040, pool=0x104541028) at
> > subversion/libsvn_ra_local/ra_plugin.c:587
> > #8  0x00000001000164b8 in svn_ra_change_rev_prop2
> > (session=0x10107e4c8, rev=199, name=0x1044e61d8 "svn:author",
> > old_value_p=0x0, value=0x104555040, pool=0x104541028) at
> > subversion/libsvn_ra/ra_loader.c:661
> > #9  0x000000010000162b in write_revprops
> > (filtered_count=0x7fff5fbfec5c, session=0x10107e4c8, rev=199,
> > rev_props=0x10454a438, pool=0x10454a028) at
> > subversion/svnsync/main.c:569
> > #10 0x0000000100002f93 in replay_rev_finished (revision=199,
> > replay_baton=0x10282b5f0, editor=0x103bda7a0, edit_baton=0x103bda820,
> > rev_props=0x1044e60a0, pool=0x1044e6028) at
> > subversion/svnsync/main.c:1168
> > #11 0x0000000100168abf in end_replay (parser=0x103d77a38,
> > userData=0x103d776a0, name={namespace = 0x103d716c0 "svn:", name =
> > 0x1009042e2 "editor-report"}) at
> > subversion/libsvn_ra_serf/replay.c:489

Re: [BUG] svnsync segfault

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Greg pointed that earlier on IRC.  I'm so far at:

[[[
Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c	(revision 1149353)
+++ subversion/libsvn_subr/io.c	(working copy)
@@ -2393,6 +2393,8 @@ handle_child_process_error(apr_pool_t *pool, apr_s
   apr_file_t *errfile;
   void *p;
 
+  SVN_DBG(("At handle_child_process_error(): got %ld, %s\n", (long)status, desc));
+
   /* We can't do anything if we get an error here, so just return. */
   if (apr_pool_userdata_get(&p, ERRFILE_KEY, pool))
     return;
@@ -2489,10 +2491,16 @@ svn_io_start_cmd2(apr_proc_t *cmd_proc,
 
   /* Forward request for pipes to APR. */
   if (infile_pipe || outfile_pipe || errfile_pipe)
-    apr_procattr_io_set(cmdproc_attr,
-                        infile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
-                        outfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
-                        errfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE);
+    {
+      apr_err = apr_procattr_io_set(cmdproc_attr,
+                                    infile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
+                                    outfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
+                                    errfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE);
+      if (apr_err)
+        return svn_error_wrap_apr(apr_err,
+                                  _("Can't set process '%s' stdio pipes"),
+                                  cmd);
+    }
 
   /* Have the child print any problems executing its program to errfile. */
   apr_err = apr_pool_userdata_set(errfile, ERRFILE_KEY, NULL, pool);
]]]

but with this applied I get some further segfaults --- apr_file_t.pool
appears to be invalid.

[[[
Copied properties for revision 10.
==14435== Warning: invalid file descriptor -1 in syscall close()
Transmitting file data ..
Committed revision 11.
==14350== Warning: invalid file descriptor 25 in syscall pipe()
==14350== Use of uninitialised value of size 4
==14350==    at 0x40B6A93: apr_file_close (open.c:233)
==14350==    by 0x4280DEE: run_hook_cmd (hooks.c:216)
==14350==    by 0x42819AB: svn_repos__hooks_pre_revprop_change (hooks.c:516)
==14350==    by 0x427F832: svn_repos_fs_change_rev_prop4 (fs-wrap.c:352)
==14350==    by 0x4268281: svn_ra_local__change_rev_prop (ra_plugin.c:587)
==14350==    by 0x40302D2: svn_ra_change_rev_prop2 (ra_loader.c:661)
==14350==    by 0x804A52D: write_revprops (main.c:569)
==14350==    by 0x804BD92: replay_rev_finished (main.c:1168)
==14350==    by 0x430280B: end_replay (replay.c:489)
==14350==    by 0x430ED69: end_xml (util.c:1280)
==14350==    by 0x4352A54: ??? (in /usr/lib/libexpat.so.1.5.2)
==14350==    by 0x43538A0: ??? (in /usr/lib/libexpat.so.1.5.2)
]]]


Lieven Govaerts wrote on Fri, Jul 22, 2011 at 10:16:07 +0200:
> Hi,
> 
> when syncing the first ~200 revisions from the asf repository over
> ra_serf to ra_local, svnsync segfaults when invoking the
> pre-revprop-change hook of the local target repo.
> 
> Not really at home in this part of the code, so if anyone can point me
> in the right direction that would be appreciated.
> 
> Lieven
> 
> 
> #0  0x00000001006b7d04 in apr_file_name_get ()
> #1  0x000000010051ce29 in stringbuf_from_aprfile
> (result=0x7fff5fbfe7b0, filename=0x0, file=0x0, check_size=1,
> pool=0x104541028) at subversion/libsvn_subr/io.c:2027
> #2  0x000000010051d18a in svn_stringbuf_from_aprfile
> (result=0x7fff5fbfe7b0, file=0x0, pool=0x104541028) at
> subversion/libsvn_subr/io.c:2106
> #3  0x000000010003bfc4 in check_hook_result (name=0x100054eaa
> "pre-revprop-change", cmd=0x104541438
> "/tmp/asfrepo/hooks/pre-revprop-change", cmd_proc=0x7fff5fbfe860,
> read_errhandle=0x0, pool=0x104541028) at
> subversion/libsvn_repos/hooks.c:71
> #4  0x000000010003c47f in run_hook_cmd (result=0x0, name=0x100054eaa
> "pre-revprop-change", cmd=0x104541438
> "/tmp/asfrepo/hooks/pre-revprop-change", args=0x7fff5fbfe900,
> stdin_handle=0x104541548, pool=0x104541028) at
> subversion/libsvn_repos/hooks.c:210
> #5  0x000000010003d057 in svn_repos__hooks_pre_revprop_change
> (repos=0x10107e590, rev=199, author=0x101095c08 "lgo",
> name=0x1044e61d8 "svn:author", new_value=0x104555040, action=77 'M',
> pool=0x104541028) at subversion/libsvn_repos/hooks.c:516
> #6  0x000000010003aecf in svn_repos_fs_change_rev_prop4
> (repos=0x10107e590, rev=199, author=0x101095c08 "lgo",
> name=0x1044e61d8 "svn:author", old_value_p=0x0, new_value=0x104555040,
> use_pre_revprop_change_hook=1, use_post_revprop_change_hook=1,
> authz_read_func=0, authz_read_baton=0x0, pool=0x104541028) at
> subversion/libsvn_repos/fs-wrap.c:352
> #7  0x000000010002350a in svn_ra_local__change_rev_prop
> (session=0x10107e4c8, rev=199, name=0x1044e61d8 "svn:author",
> old_value_p=0x0, value=0x104555040, pool=0x104541028) at
> subversion/libsvn_ra_local/ra_plugin.c:587
> #8  0x00000001000164b8 in svn_ra_change_rev_prop2
> (session=0x10107e4c8, rev=199, name=0x1044e61d8 "svn:author",
> old_value_p=0x0, value=0x104555040, pool=0x104541028) at
> subversion/libsvn_ra/ra_loader.c:661
> #9  0x000000010000162b in write_revprops
> (filtered_count=0x7fff5fbfec5c, session=0x10107e4c8, rev=199,
> rev_props=0x10454a438, pool=0x10454a028) at
> subversion/svnsync/main.c:569
> #10 0x0000000100002f93 in replay_rev_finished (revision=199,
> replay_baton=0x10282b5f0, editor=0x103bda7a0, edit_baton=0x103bda820,
> rev_props=0x1044e60a0, pool=0x1044e6028) at
> subversion/svnsync/main.c:1168
> #11 0x0000000100168abf in end_replay (parser=0x103d77a38,
> userData=0x103d776a0, name={namespace = 0x103d716c0 "svn:", name =
> 0x1009042e2 "editor-report"}) at
> subversion/libsvn_ra_serf/replay.c:489