cygrunsrv + sshd + rsync = 20 times too slow -- throttled?
Ken Brown
kbrown@cornell.edu
Sat Aug 28 15:17:07 GMT 2021
On 8/28/2021 4:43 AM, Corinna Vinschen via Cygwin wrote:
> On Aug 28 02:21, Takashi Yano via Cygwin wrote:
>> On Fri, 27 Aug 2021 12:00:50 -0400
>> Ken Brown wrote:
>>> Two years ago I thought I needed nt_create to avoid problems when calling
>>> set_pipe_non_blocking. Are you saying that's not an issue? Is
>>> set_pipe_non_blocking unnecessary? Is that the point of your modification to
>>> raw_read?
>>
>> Yes. Instead of making windows read function itself non-blocking,
>> it is possible to check if the pipe can be read before read using
>> PeekNamedPipe(). If the pipe cannot be read right now, EAGAIN is
>> returned.
>
> The problem is this:
>
> if (PeekNamedPipe())
> ReadFile(blocking);
>
> is not atomic. I. e., if PeekNamedPipe succeeds, nothing keeps another
> thread from draining the pipe between the PeekNamedPipe and the ReadFile
> call. And as soon as ReadFile runs, it hangs indefinitely and we can't
> stop it via a signal.
>
> Is a blocking ReadFile actually faster than a non-blocking read? Or
> does it mainly depend on BYTE vs. MESSAGE mode?
>
> What if the pipe is created non-blocking and stays non-blocking all the
> time and uses BYTE mode all the time? Just as sockets, it would always
> only emulate blocking mode. Wouldn't that drop code size a lot and fix
> most problems?
It would certainly reduce the code size. I think it's worth a try, and we can
see if any problems remain.
Ken
More information about the Cygwin
mailing list