cygrunsrv + sshd + rsync = 20 times too slow -- throttled?

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Aug 30 20:21:05 GMT 2021


On Aug 30 14:59, Ken Brown wrote:
> On 8/30/2021 1:00 PM, Corinna Vinschen wrote:
> > [...]
> > So: write.WriteQuotaAvailable == InboundQuota - read.ReadDataAvailable.
> > 
> > Except when a ReadFile is pending on the read side.  It's as if the
> > running ReadFile already reserved write quota.  So the write side
> > WriteQuotaAvailable is the number of bytes we can write without blocking,
> > after all pending ReadFiles have been satisfied.
> > 
> > Unfortunately that doesn't really make sense when looked at it from the
> > user space.
> > 
> > What that means in the first place is that WriteQuotaAvailable on the
> > write side is unreliable.  What we really need is InboundQuota -
> > read.ReadDataAvailable.  The problem with that is that the write side
> > usually has no access to the read side of the pipe.
> 
> For the purposes of select.cc:pipe_data_available, we only need to know
> whether InboundQuota - read.ReadDataAvailable is positive.  If
> WriteQuotaAvailable is positive, then we're OK, even though its precise
> value might be too small.  But if WriteQuotaAvailable == 0, we don't know
> whether the buffer is actually full or there's a pending ReadFile.  It's
> only in this case that we need access to the read side.

Any ReadFile with buffer size >= pipe buffer size will trigger that
immediately.

> What if we reverse the roles of the read and write sides of the pipe, so
> that the write side is the server and the read side is the client.  We can
> then try to use ImpersonateNamedPipeClient to get information about the read
> side when WriteQuotaAvailable == 0.

It's not a problem of impersonation, it's the problem of not having
access to the read side, because the write side just doesn't know
what handle in which process constitutes the read side of the pipe.
For all the write side knows, it could be some other fhandler in the
same process, or some far away HANDLE in some far away process in
the same session, sometimes not even a Cygwin process.


Corinna


More information about the Cygwin-developers mailing list