PATCH/RFC: Another stab at the Cygwin hang problem

Anthony Heading aheading at
Sun Jul 13 00:42:52 EST 2003

On Sat, Jul 12, 2003 at 03:52:59AM -0700, jw schultz wrote:
> There is a huge window between the write() and the return of
> waitpid() that depending on scheduling and signal delivery
> allows the child pid to be reaped by SIGCHILD handler.  That
> results in this waitpid() returning -1 with errno of ECHILD.
> EINTER would also be possible.  The timing dependencies
> account for intermittency of the error.

Hi JW - 

Afraid I've not really been following the rsync mailing list,
and it seems you've been addressing your comments about
my patch to James Tillman?

As I said originally, it was illustrative patch - I didn't
flesh out the error handling since that made the concept
more difficult to follow.

Catching up now, I think your observation here is right.
In fact I'd made a similar change already myself locally.

Only one difference - I was conciously avoiding calling
wait_process(), since that function calls msleep() - which
was implicated in the original hanging problem!  Since
there is no signal being sent any more, hopefully it's not
a problem (except for the SIGUSR2 cases?) - however I
was wanting to ensure that the hangs were _completely_
eliminated, and thus didn't want to take any chances.

So my own patch here is checking the errno and gives
the OK for ECHILD.  I would worry that the whole
msleep NOHANG io_flush stuff is a very complex loop
to run simply to collect an exit status, particularly
when we believe that the root of the hang lies with
the underlying Cygwin OS.

But I think as long as the hangs don't reappear, your
updated patch is obviously more concise.  Otherwise, I'll be
further tempted to take the axe to the SIGCHLD handling,
which looks somewhat jammed with voodoo cruft.

Anyhow, just to let you know.  If you're happy tidying
up and refining the patch yourself, please go ahead. If
you want to me to do anything, or have any comments on
what I've done, I'd appreciate an email.  However I
will try to follow the rsync list for the next few
weeks at least.



This communication is for informational purposes only.  It is not intended as
an offer or solicitation for the purchase or sale of any financial instrument
or as an official confirmation of any transaction. All market prices, data
and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of J.P. Morgan Chase & Co., its
subsidiaries and affiliates.

More information about the rsync mailing list