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

Re: svn 1.3.0: post-commit hook waits even if tasks are backgrounded

From: Peter N. Lundblad <peter_at_famlundblad.se>
Date: 2006-01-17 20:23:46 CET

On Tue, 17 Jan 2006, Max Bowsher wrote:

> > ------------------------------------------------------------------------
> >
> > Fix bug made more visible by r13973. If a hook script put jobs in the
> > background, the svn operation would block waiting for the background
> > processes to finish even if the hook script itself had exited.
> >
> > Found by: loren jan wilson <loren@solar.uchicago.edu>
> >
> > * subversion/libsvn_repos/hooks.c (run_hook_cmd): Make the read and write
> > ends of the stderr pipe non-inherited by child processes.
> >
> >
> > Index: subversion/libsvn_repos/hooks.c
> > ===================================================================
> > --- subversion/libsvn_repos/hooks.c (revision 18097)
> > +++ subversion/libsvn_repos/hooks.c (arbetskopia)
> > @@ -66,6 +66,16 @@
> > return svn_error_wrap_apr
> > (apr_err, _("Can't create pipe for hook '%s'"), cmd);
> >
> > + /* Pipes are inherited by default, but we don't want that, since
> > + APR will duplicate the write end of the pipe for the child process.
> > + Not closing the read end is harmless, but if the write end is inherited,
> > + it will be inherited by grandchildren as well. This causes problems
> > + if a hook script puts long-running jobs in the background. Even if
> > + they redirect stderr to something else, the write end of our pipe will
> > + still be open, causing us to block. */
> > + apr_file_inherit_unset (read_errhandle);
> > + apr_file_inherit_unset (write_errhandle);
> > +
> > /* Redirect stdout to the null device */
> > apr_err = apr_file_open (&null_handle, SVN_NULL_DEVICE_NAME, APR_WRITE,
> > APR_OS_DEFAULT, pool);
>
>
> I like this solution, but shouldn't we be checking for error return from
> those APR calls?
>
Of course we should; I just tested this sloppily. I was going to reply
about this obvious thing to my mail, but tigris was slow today.

Thanks for reminding anyway,
//Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jan 17 22:54:23 2006

This is an archived mail posted to the Subversion Dev mailing list.