X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 11E77385741D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1630232919; bh=11bAoAZiaecwYZWXm6AW6LjwFgWfaLwhLDsIuopZQY8=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=VALLCysve7gaPcJO4dz4FwdKpd5m4dP8fP39gAHPQbIoSLj54TIXaIzISs49lhCww 7zzEK4IzS+DE34XbneI3wI8OSHSU7tRiHfjXCdQ5+ttAxD9OARreMlKHSAOBzNcSw6 AX6kjdxNtGUSlFP+7Vx49c1P3FmHzVdcoHZjuYxw= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0FCD83858403 Date: Sun, 29 Aug 2021 12:27:54 +0200 To: cygwin AT cygwin DOT com Subject: Re: cygrunsrv + sshd + rsync = 20 times too slow -- throttled? Message-ID: Mail-Followup-To: cygwin AT cygwin DOT com References: <20210826062934 DOT 54f2f2216021c095bb7ba13b AT nifty DOT ne DOT jp> <3b560051-ab27-f392-ca4b-d1fd9b5733b0 AT cornell DOT edu> <20210827202440 DOT 47706fc2fc07c5e9a1bc0047 AT nifty DOT ne DOT jp> <4f2cb5f3-ce9c-c617-f65f-841a5eca096e AT cornell DOT edu> <20210828022111 DOT 91ef5b4ff24f6da9fadb489e AT nifty DOT ne DOT jp> <20210828184102 DOT f2206a8a9e5fe5cf24bf5e45 AT nifty DOT ne DOT jp> <20210829004346 DOT c2f80469abc3a07fd4b2918d AT nifty DOT ne DOT jp> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210829004346.c2f80469abc3a07fd4b2918d@nifty.ne.jp> X-Provags-ID: V03:K1:fpP5ykTsem/uVjj/U64tpMRbu5O73FC4ZurvM2iZokOvv5ermPF IaiYz06qfY9i7sBDXu++y/TCIEoNL77vj+Ecf43dDNq7dENlIAv4dHOI3HM6taj5HrfTsaD NPuUJ17I62aEA3avEUKI3CceQ59bjp8RVozVUToa9dDr+eK+be6ceu2ykm9dd2jE0n1/sXZ WhvOrOS7z4+1AeZY35oLQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:suC7HD7/l9E=:kENeG3AZKNoT2UBHTKijWq BpCV0Q8QnKuhMmpksiM7Oa4ckJsFD+cfW5VYMR2tuVJ8E5MxUoGEaBcW1X94//5a8iOv/UMjW YMI+HuaL9FkdNmwrLyd01eEmJ3ODDGnZo5SKi6cF+81/8DoM7ElWcwkv1GQks+TWcmV8XBTHp g/BXxRa64J5+TSykB1NzihGVtmGoLYom9RQhnZoWHng2VJp2PQdT66lqu766TnphFgygEz/Pd SzoVc8zG/h/iHhZww7WZC6FTPeI6xLEV3y3QEDCjN2FMnRbMZyEidGzQ8w4wEnUy6PdJIm4cD oq1n/7TA0x0Suz2xZkXT9cmnR+YGYfN9RJX4ADgUnLPk648ZR1jDOtczR6U/eUOrWwhLW8vrm We7kOWwjMpQ7Xv+uGHbeJhHFF0RgB1C5OxzUuo1qKkJ0FuhD5zp7429Z8b6G83RUMQTmV3vgb LPRF4eKWfuGbr4j7Q56XOe1aqq0ThaknacPD0cr4vCpesvJy4cAosvb1N7cviqfgENaxKYroI 1/sa8NBMm9P8qL5F3DNVqmnPnt4iMgPehU2Z42xh1DP35r693X8Qm0hpKTUczarcoVaZODLpE SIVxgVXXaS/aZfeAALxenI1tulU5leoDqJotoMfhAD4tJX26RRkUTTpFYtdOJ7m9u1Q4j0kAy 0z4wxnVHf6y8Qm+N6APjLF84oezndw+v8wm21OH/2qNkxvBF2fEoSdquPWK7T/zYMfAeRwYag uDhghK5ryCE2zZADfFtzXmYAtN8qA1/b+FLmNO5T3Q2WCUb7OGvC5bo7hhs= X-Spam-Status: No, score=-100.0 required=5.0 tests=BAYES_00, GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" On Aug 29 00:43, Takashi Yano via Cygwin wrote: > On Sat, 28 Aug 2021 13:58:08 +0200 > Corinna Vinschen wrote: > > On Aug 28 18:41, Takashi Yano via Cygwin wrote: > > > On Sat, 28 Aug 2021 10:43:27 +0200 > > > Corinna Vinschen 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. > > > > > > Hmm, you are right. Mutex guard seems to be necessary like pty code > > > if we go this way. > > > > > > > Is a blocking ReadFile actually faster than a non-blocking read? Or > > > > does it mainly depend on BYTE vs. MESSAGE mode? > > > > > > Actually, I don't think so. Perhaps it is not essential problem of > > > overlapped I/O but something is wrong with current pipe code. > > > > > > > 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? > > > > > > If 'non-blocking' means overlapped I/O, only the problem will be: > > > https://cygwin.com/pipermail/cygwin/2021-March/247987.html > > > > Sorry if that wasn't clear, but I was not talking about overlapped I/O, > > which we should get rid off, but of real non-blocking mode, which > > Windows pipes are fortunately capable of. > > Do you mean, PIPE_NOWAIT flag? If this flags is specified in > the read pipe, non-cygwin apps cannot read the pipe correctly. Do you mean after execve? If the child is a non-Cygwin process, we could run a loop over the stdio descriptors in child_info_spawn::worker setting pipes to blocking. But that's a corner problem, easily solved. It's more important that it works nicely for Cygwin processes. Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple