Well, since the rsync behaviour is known and has been discussed on  
cygwin mailing list for years and no alternative was ever given, I  
guess there is none in general case.

Note that the specific problem (AFAIK) was that select() can not tell  
whether write() would block on a pipe. That is, when your process  
does write() on a pipe, and if the other process wants to write  
before reading, you've got a deadlock, since you are waiting for  
write (which you were told would not block!) to finish and the other  
side is also waiting for its write to finish.

Specific, quick and dirty workaround is to always write via another  
thread (so it is non-blocking). In general that is very expensive and  
error-prone, but if you know the specifics of the program, you can  
get away with simple solutions most of the time. E.g. write using  
thread, setting a variable before write and clearing after write  
finishes, and the main program checks this variable before doing  
select or another write.

That is about everything I can tell you, because I got around this  
mess by choosing simpler half-duplex communication solution...

izidor


On 31.7.2007, at 15:23, Jamis Buck wrote:

>
> Thank-you for the tip, Izidor! I appreciate the heads-up. What are the
> alternatives? Using threads to do polling currently makes Net::SSH
> really brittle.
>
> I'll be doing some Windows testing before I release, so we'll see if
> anything comes up at that time.
>
> - Jamis
>
> On 7/31/07, Izidor Jerebic <[EMAIL PROTECTED]> wrote:
>>
>>
>> On 26.7.2007, at 22:17, Jamis Buck wrote:
>>
>>>
>>> I'm still suspecting Net::SSH, myself, and it's wild and unnecessary
>>> use of threads. The good news, though, is that Net::SSH v2 is coming
>>> along nicely, and uses IO.select instead of threads, which it should
>>> have done all along.
>>
>> Jamis,
>>
>>  From one of my extremely unpleasant (but luckily very rare)
>> excursions into the beautiful world of microsoft:
>>
>> I have never looked into Net:SSH code, but one word of caution about
>> using select() or its win32 equivalent on windose: there is a well-
>> known fact that there is a problem with non-blocking pipes and select
>> () - pipes cannot be used in a non-blocking way and this can lead to
>> deadlocks. The most famous problem (AFAIK) related to this is cygwin
>> rsync hanging while using ssh for communication with server (rsync
>> uses select() for full-duplex I/O).
>>
>> Maybe it's nothing, but just so you know...
>>
>> izidor
>>
>> P.S. I don't care if cap works on windose or not (I avoid MS as much
>> as I can), so this email is just a public service, sort of :-)
>>
>>
>>>
>>
>
> >


--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to