delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 5EBBF385841C |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1630310649; | |
bh=qZDgm+RujyQKYCk3KrNL4ykvhvBa6lE8YXNCTuAHMNw=; | |
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: | |
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: | |
From; | |
b=sgAoXAHn9CIyXdw5fGLno5aEtv06oKaFDrVufL7yQP/z6rhtQoYfZl/D9yhNpbdDG | |
w1orPpNUG8ZN4y9yeKB2114pzpb760H0BWQNJAwPKCMb3+3XArgz9qbYm8uUIzBDOl | |
9R960lZ/aLrjw8A7mswuAu8zDP7DRsk2gR99pBJY= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DMARC-Filter: | OpenDMARC Filter v1.4.1 sourceware.org 41CBC385840D |
DKIM-Filter: | OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com 17U824bM024433 |
X-Nifty-SrcIP: | [110.4.221.123] |
Date: | Mon, 30 Aug 2021 17:02:04 +0900 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: cygrunsrv + sshd + rsync = 20 times too slow -- throttled? |
Message-Id: | <20210830170204.fa91eaf110f310f13b67abc3@nifty.ne.jp> |
In-Reply-To: | <d217ef03-7858-5e22-0aa6-f0507eedd9da@cornell.edu> |
References: | <41A583E1-C8E7-42AB-9F24-EEC33A41EC60 AT house DOT org> |
<20210825201845 DOT 07b6400b79dc5558a7761efe AT nifty DOT ne DOT jp> | |
<f8106fe7-a2b8-d106-3061-4d888124f4b0 AT cornell DOT edu> | |
<20210826062934 DOT 54f2f2216021c095bb7ba13b AT nifty DOT ne DOT jp> | |
<d0a8c57d-1ed1-6b4f-c6e7-cbe0e2ec8a1c AT cornell DOT edu> | |
<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> | |
<YSn3L0W1M527utK0 AT calimero DOT vinschen DOT de> | |
<20210828184102 DOT f2206a8a9e5fe5cf24bf5e45 AT nifty DOT ne DOT jp> | |
<20210829180729 DOT 48b4e877f773cb3980c5766d AT nifty DOT ne DOT jp> | |
<c62d18df-ab7a-7233-62ee-29a8eced5353 AT cornell DOT edu> | |
<20210830091314 DOT f9a2cb71794d0f68cdb5eba7 AT nifty DOT ne DOT jp> | |
<20210830092259 DOT 52f7d54fc3fa340738373af4 AT nifty DOT ne DOT jp> | |
<d217ef03-7858-5e22-0aa6-f0507eedd9da AT cornell DOT edu> | |
X-Mailer: | Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) |
Mime-Version: | 1.0 |
X-Spam-Status: | No, score=-4.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, |
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, | |
SPF_HELO_NONE, SPF_PASS, 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 |
List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
List-Unsubscribe: | <https://cygwin.com/mailman/options/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe> | |
List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
From: | Takashi Yano via Cygwin <cygwin AT cygwin DOT com> |
Reply-To: | Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp> |
Errors-To: | cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com |
Sender: | "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com> |
On Sun, 29 Aug 2021 22:15:29 -0400 Ken Brown wrote: > On 8/29/2021 8:22 PM, Takashi Yano via Cygwin wrote: > > On Mon, 30 Aug 2021 09:13:14 +0900 > > Takashi Yano wrote: > >> On Sun, 29 Aug 2021 17:04:56 -0400 > >> Ken Brown wrote: > >>> On 8/29/2021 5:07 AM, Takashi Yano via Cygwin wrote: > >>>> On Sat, 28 Aug 2021 18:41:02 +0900 > >>>> Takashi Yano 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. > >>>> > >>>> I have found that set_pipe_non_blocking() succeeds for both read and > >>>> write pipes if the write pipe is created by CreateNamedPipe() and the > >>>> read pipe is created by CreateFile() contrary to the current create() > >>>> code. Therefore, not only nt_create() but also PeekNamedPipe() become > >>>> unnecessary. > >>>> > >>>> Please see the revised patch attached. > >>> > >>> I haven't had a chance to test this myself yet, but occurs to me that we might > >>> have a different problem after this patch: Does the write handle that we get > >>> from CreateNamedPipe() have FILE_READ_ATTRIBUTES access? > >> > >> I have just checked this, and the answer is "No". Due to this problem, > >> NtQueryInformationFile() call in select() fails on the write pipe. > >> > >> It seems that we need more consideration... > > > > We have two easy options: > > 1) Configure the pipe with PIPE_ACCESS_DUPLEX. > > 2) Use nt_create() again and forget C# program issue. > > I vote for 2), but let's see what Corinna thinks. BTW. what's wrong if just: static int nt_create (LPSECURITY_ATTRIBUTES sa_ptr, PHANDLE r, PHANDLE w, DWORD psize, int64_t *unique_id) { if (r && w) { static volatile ULONG pipe_unique_id; LONG id = InterlockedIncrement ((LONG *) &pipe_unique_id); if (unique_id) *unique_id = ((int64_t) id << 32 | GetCurrentProcessId ()); if (!CreatePipe (r, w, sa_ptr, psize)) { *r = *w = NULL; return GetLastError (); } } return 0; } ? In my environment, I cannot find any defects. - No performance degradation. - set_pipe_non_blocking() works for both read and write pipes. - NtQueryInformationFile() in select() works for both r/w pipes. - Piping C# program works. Is naming the pipe really necessary? -- Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp> -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |