Subject: Re: rsync fork/exec problem with odd twist for native windows programs
From: "Brett Serkez" <[email-masked]>
To: "Scott Bolte" <[email-masked]>
Cc: [email-masked]
Date: Sat, 18 Feb 2006 16:30:21 -0500

Scott,

>       Thanks for the suggestion.  Switching from socketpair() to
>       pipe() does let ssh get going, but rsync later runs into
>       problems. A few minutes into the transfer it just hangs.

I've actually been able to run fine once past the initial hang, but I've
seen reports of random hangs at later points by others, usually around
magic numbers.  Not sure if there might be a buffering issue, but I
think the hangs are usually the result of rsync on each end coming out
of step with the other.

>       Since I exercised ssh by transferring 16MB files back and forth
>       for 10 minutes, I'm inclined to point the finger at rsync.
>       However, I use the same version of rsync on another system where
>       it runs like a champ. That doesn't leave any suspects.

This issue forced me to look at the rsync protocol in some detail, and I
am reasonably sure it is tight.  Rsync, like similar protocols, it is
highly dependent upon the socket to insure correct operation.  That is
the rsync protocol is lock-step, one side writes and then reads, while
the other reads and then writes.  This is a precise exchange, if one
side misses data it will attempt to read or write while it should be
doing the other and then hang endlessly as each end hopelessly waits for
the other.

Since rsync is creating ssh as the child, which owns the socket, and
we've seen a different behavior between a socketpair and a pipe, I have
to suspect there is something not right between rsync and ssh over the
pipe, something not being relayed from/to the socket that is causing the
loss of sync.

>       I'm still puzzled as to why even true.exe hung. I did not want
>       to make my problem report even longer, but I had another test
>       program which was literally "int main() { exit(0) }", just in
>       case true.exe was not as minimal as expected. That test program
>       also hung when spawned by rsync.

Yes, interesting and puzzling.

Brett
----------------------------------------------------------------
Brett C. Serkez, Techie

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/