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

Intermittent error running hooks: No child processes

From: Dennis McRitchie <dmcr_at_Princeton.EDU>
Date: Fri, 12 Dec 2008 16:56:29 -0500

Hi,

We are providing a subversion service to the University community,
running v1.5.2, and our users were getting an intermittent error when
committing changes, or when changing the svn:log property using the
Linux svn client.

A typical commit error was:
------------------------------------
> svn commit .
Sending newdir/newfile
Transmitting file data .
Committed revision 25.
Error waiting for process
'<svn-root-dir>/<repo-name>/hooks/post-commit': No child processes
------------------------------------

If this were an 'svn propset' or 'svn propedit' command to change a
previous log message, the error would be on the pre-revprop-change hook
as follows:

Error waiting for process
'<svn-root-dir>/<repo-name>/hooks/pre-revprop-change': No child
processes

In the commit case, the commit went through, and the post-commit hook
was successfully executed, so this was only a nuisance, and merely
confused some of our users.

But in the propset/propedit case, the error occurred when executing the
pre-revprop-change hook, so the change never took place in those cases
where the error occurred.

The problem was in function svn_io_wait_for_cmd()
(subversion/libsvn_subr/io.c) in the following code:
------------------------------------
  /* Wait for the cmd command to finish. */
  apr_err = apr_proc_wait(cmd_proc, &exitcode_val, &exitwhy_val,
APR_WAIT);
  if (!APR_STATUS_IS_CHILD_DONE(apr_err))
    return svn_error_wrap_apr(apr_err, _("Error waiting for process
'%s'"),
                              cmd);
------------------------------------

apr_err was frequently being set to ECHILD, thus resulting in the error
I am reporting. I am assuming that it was happening in those cases where
the hook script completed its execution before the call to
apr_proc_wait(), since the hook script *always* executed successfully.

Note that apr_proc_wait() only ignores the EINTR error, and so will
return ECHILD if the specified process has completed execution before
waitpid() is called. Since this was a race condition, the error
sometimes happened, and sometimes did not.

I corrected the problem by changing the code as shown below.

------------------------------------
  /* Wait for the cmd command to finish. */
  apr_err = apr_proc_wait(cmd_proc, &exitcode_val, &exitwhy_val,
APR_WAIT);
  if (!APR_STATUS_IS_CHILD_DONE(apr_err) && apr_err != ECHILD)
    return svn_error_wrap_apr(apr_err, _("Error waiting for process
'%s'"),
                              cmd);
------------------------------------

Now, ECHILD is accepted as a normal return, and all commits, propsets,
and propedits complete without any error. This may not be the optimal
fix, of course, but it did solve my problem.

You may want to consider handling the ECHILD case in future releases,
since this is a very confusing error that, from googling, a number of
other people have encountered as well.

Best regards,
             Dennis

Dennis McRitchie
Computational Science and Engineering Support (CSES)
Academic Services Department
Office of Information Technology
Princeton University

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=983552
Received on 2008-12-12 23:29:24 CET

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.