Cygwin Rsync 2.5.6 over SSH hangs on Win2k->Win2k

cbarratt at users.sourceforge.net cbarratt at users.sourceforge.net
Fri Jun 27 15:48:06 EST 2003


> When using Cygwin Rsync 2.5.6/OpenSSH 3.6.1 for copying files from
> Win2k->Win2k, I get 2 or 3 hung processes on the receiving-side out of about
> every 50 runs.  These hung processes cause the system to be unable to
> reboot(?!), requiring a hard reset.  Killing the processes allows a graceful
> reboot every time.  I'm currently running both ssh and rsync as services on
> the recieving side.  Originally, I ran them as the SYSTEM user, but that
> prevented easy killing of the processes, so I now run them under an
> administrative account.

This has been reported by a number of users.  Happily(?), it started to
happen to me a week ago so I have been able to poke around and see what
is happening.

At the end of the transfer, on the receiving machine the child goes
into an msleep loop waiting for the parent to kill it with a
USR2 signal.  See line 442 of main.c (rsync 2.5.6):

        /* finally we go to sleep until our parent kills us
           with a USR2 signal. We sleep for a short time as on
           some OSes a signal won't interrupt a sleep! */
        while (msleep(20))
                ;

On cygwin the child sometimes hangs at this point.  When this happens,
any cygwin signal fails to kill the child (including kill -9).

While I haven't found the root cause (and I don't know any cygwin
internals), the following workaround solves the problem for me.
Replace msleep() wit sleep():

        while ( 1 ) {
            sleep(1);
        }

There's something about signals and msleep() that cygwin doesn't grok...

Craig



More information about the rsync mailing list