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

Re: Spuriously failing hook scripts

From: Malcolm Rowe <malcolm-svn-dev_at_farside.org.uk>
Date: 2006-09-13 11:20:27 CEST

On Tue, Sep 12, 2006 at 02:33:36PM +0200, Franz Sirl wrote:
> 6834 clone(child_stack=0,
> flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
> child_tidptr=0xb7adbb68) = 15158
> ...
> 15158 execve("/home/svn/repos/t32/hooks/pre-commit",
> ["/home/svn/repos/t32/hooks/pre-co"..., "/home/svn/repos/t32", "4x3"],
> [/* 0 vars */]) = 0
> 15158 brk(0) = 0x804a000
> ...
> 15158 exit_group(0) = ?
> 6834 <... read resumed> "", 8192) = 0
> 6834 --- SIGCHLD (Child exited) @ 0 (0) ---
> 6834 waitpid(-1, NULL, WNOHANG) = 15158
> 6834 waitpid(-1, NULL, WNOHANG) = -1 ECHILD (No child processes)
> 6834 rt_sigaction(SIGCHLD, {0xb78d6300, [CHLD], SA_RESTART},
> {0xb78d6300, [CHLD], SA_RESTART}, 8) = 0
> 6834 sigreturn() = ? (mask now [])

Here's the immediate problem. The calling process received a SIGCHLD
and waits for all terminating children (reaping zombies). It discards
the exit codes of the children.

This is probably happening somewhere in APR, but I'm not sure where.
(Note that the interaction of waitpid() and SIGCHLD differs between Linux
2.4 and 2.6 kernels. I'm not sure if that's important.)

> 6834 waitpid(15158, 0xbfc1a118, WSTOPPED) = -1 ECHILD (No child processes)

Here's the secondary problem (WSTOPPED is the same as WUNTRACED,
by the way). The APR aprproc_wait() call is returning ECHILD, but we
aren't checking for errors in svn_io_wait_for_cmd(), other than for the
APR-specific APR_STATUS_IS_CHILD_NOTDONE().

We should definitely fix the error-reporting problem. It's probably
sufficient to change 'if (APR_STATUS_IS_CHILD_NOTDONE(apr_err)' to 'if
(!APR_STATUS_IS_CHILD_DONE(apr_err))' - most likely we didn't expect
to receive any other errors than APR_CHILD_DONE - the APR documentation
doesn't mention that any others are possible, though both Unix and Win32
implementations can return OS errors).

We also should take a look at what APR (I assume it's APR rather than us)
is doing with the SIGCHLD handler as well.

Regards,
Malcolm

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Sep 13 11:21:13 2006

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.