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

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Sep 15 09:57:44 GMT 2021


On Sep 15 09:59, Takashi Yano wrote:
> On Wed, 15 Sep 2021 09:44:54 +0900
> Takashi Yano wrote:
> > On Wed, 15 Sep 2021 09:21:00 +0900
> > Takashi Yano <takashi.yano@nifty.ne.jp> wrote:
> > > I have one patch attched. This make select() on pipe faster a bit.
> > 
> > Revised a bit.
> 
> Add missing error handling.

Patch pushed, but I wonder...

> @@ -633,17 +633,15 @@ pipe_data_available (int fd, fhandler_base *fh, HANDLE h, bool writing)
>        /* Note: Do not use NtQueryInformationFile() for query_hdl because
>  	 NtQueryInformationFile() seems to interfere with reading pipes
>  	 in non-cygwin apps. Instead, use PeekNamedPipe() here. */

...so we're not using NtQueryInformationFile on the query_hdl...

> -      if (fh->get_device () == FH_PIPEW)
> +      if (fh->get_device () == FH_PIPEW && fpli.WriteQuotaAvailable == 0)
>  	{
>  	  HANDLE query_hdl = ((fhandler_pipe *) fh)->get_query_handle ();
> -	  if (query_hdl)
> -	    {
> -	      DWORD nbytes_in_pipe;
> -	      PeekNamedPipe (query_hdl, NULL, 0, NULL, &nbytes_in_pipe, NULL);
> -	      fpli.WriteQuotaAvailable = fpli.InboundQuota - nbytes_in_pipe;
> -	    }
> -	  else
> +	  if (!query_hdl)
> +	    return 1; /* We cannot know actual write pipe space. */
> +	  DWORD nbytes_in_pipe;
> +	  if (!PeekNamedPipe (query_hdl, NULL, 0, NULL, &nbytes_in_pipe, NULL))
>  	    return 1;
> +	  fpli.WriteQuotaAvailable = fpli.InboundQuota - nbytes_in_pipe;
>  	}
>        if (fpli.WriteQuotaAvailable > 0)

...but we're unconditionally using NtQueryInformationFile at the start
of pipe_data_available.  If this is the read side of the pipe, isn't
there a chance that another (non-Cygwin) process is performing a blocking
read and this call will hang?

Btw., this doesn't work as expected:

$ yes | /cygdrive/c/Windows/System32/more

It just hangs until pressing Ctrl-C.  Is that expected currently?


Corinna


More information about the Cygwin-developers mailing list