rsync over ssh hang issue understood

Christopher Faylor
Fri Jun 30 04:55:00 GMT 2006

On Thu, Jun 29, 2006 at 11:36:41PM -0400, Lev Bishop wrote:
>On 6/29/06, Christopher Faylor wrote:
>>The idea of using threads for pipe writing has been bounced around for
>>a long time.  It doesn't solve the select problem if there are multiple
>>processes writing to one pipe.  That is not a completely unusual event,
>Could you be more specific on how it doesn't solve the select problem
>in when there are multiple processes writing on the pipe?  As far as I
>can tell, if (and its a big if) we can build something with threads
>that works for a single process, it should work just as well for
>multiple processes.  Can you give an example sequence of writes and
>selects that illustrates the problem?  (Not that I think the thread
>approach is without problems, I just can't see this one).

Ok.  I just skimmed the proposal before and now I have read it more
thoroughly.  The multi-process problem that I was thinking about may
not be there but it still doesn't seem very foolproof.

If I understand the plan correctly, in the scenario where select says
it's ok to write but it really isn't, the write would return as if it
succeeded and a writer thread would be created which sits around trying
to empty the pipe.  If this happened with a bunch of processes writing
to a pipe, it seems like there would be potential ordering problems if,
say, a master process was telling subprocesses to write to a pipe in
a round robin fashion.  In that scenario, if you have n processes, you
could conceivably have n people, blocking waiting to write to a pipe
and the writes might be executed in random order.

Also, in the sequence of events:

does select say I can write to the pipe?
   yes:  write to the pipe
   no: do something else

The "do something else" will always be "off-by-one" since we can't
actually detect if it is ok to write to a pipe until we actually do the
write to the pipe.


Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list