delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/08/29/22:16:56

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 00DDA3858417
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1630289815;
bh=kslc4O+IugGcczV+sUu3UkHnuPJbVdIOSIw45QhbMnI=;
h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=Ii3UWOqs7I6Ijk1npSfJ43k99nPyrep+fGTXRnTjP5mEI8KTgA91RoNToC6E6ON0u
WYPkpgf13tOC/zx84ji+cUv5BRVBw97Ma5wwOWQf60gxWB1xmLXnQh8ROecRpvLy+3
SnldDS0q6xnjj1Ra1h77vMIwB3wJ+uxfpjjV22VE=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2AB953858C3B
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=A8kYtYRxBXDvd1eqfMCJbOyw3biFUSp0U49RZrWM2Kl3zRtaS3pb/YQuX6ghLRZZrB+dBt3fd9bzL2x4K7PPBqpjTaplE5dixzR/6oCcZP2z944dr8zny4Q4WvNYC/VP68IN9PLY6mofXTb3qE3zdl/4wmB/Ree8Y0ONfw2xL7GkHTpajc5oE8zhcIVrWyio1iPQ+LCle26QZvmb2syKdZcZJ6rYhkmxIprShne7MXCDePZf0vafkwznetanRjyTKkaeTvKZufz6OeZPAXI89o7pZv5NOwxDf6PHr6vem9hq2A+wE1xpX9dPY8+I9ffmDfM/zmPwH9FxzJLz8cXZ8g==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector9901;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=afM2MlsqQJm5Ayh3DLcSx/BggGrtDJ8VC6GoZT7fjwY=;
b=QpAqu+RaNaSN1SR/ee4oI3KfEUonB1eWbZnc/Tp+wDGvrNzjQoxzz+lwXk8uohcurhJG2QFOTBENybgi9gc6DnxgB3vyc2LjMc0c/EnXBAQN/dR/B1LUGUpznZXqgZKNXs++M60lYlDe/oj/1v6Rd89c8cY101rxwvg+Krhwj2RoHbxkDFOYVoKVMyjm90AzqvDoNubxxvMYxol0mkuz4N8ZjsRHU1kAcIMADHbSiKXkJ6LJBLELV6KCW4dYEIjUa90fmPi3w+4jZGutmi33Ht6slhvm68/C3pnbk37y3gbIJPC2Md3nqBnivHiuvtvL2Vvn170SUjZ/ccSF3X9fxQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu;
dkim=pass header.d=cornell.edu; arc=none
Subject: Re: cygrunsrv + sshd + rsync = 20 times too slow -- throttled?
To: cygwin AT cygwin DOT com
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>
Message-ID: <d217ef03-7858-5e22-0aa6-f0507eedd9da@cornell.edu>
Date: Sun, 29 Aug 2021 22:15:29 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
In-Reply-To: <20210830092259.52f7d54fc3fa340738373af4@nifty.ne.jp>
X-ClientProxiedBy: MN2PR14CA0002.namprd14.prod.outlook.com
(2603:10b6:208:23e::7) To BN7PR04MB4388.namprd04.prod.outlook.com
(2603:10b6:406:f8::19)
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: 1b9d57ed-6373-4e1a-5d7f-08d96b5c0a63
X-MS-TrafficTypeDiagnostic: BN8PR04MB6369:
X-Microsoft-Antispam-PRVS: <BN8PR04MB6369885F07A3818C0269049ED8CB9 AT BN8PR04MB6369 DOT namprd04 DOT prod DOT outlook DOT com>
X-MS-Oob-TLC-OOBClassifiers: OLM:4941;
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: 391BLVtI/dVd2w+OBUu768vCOzbtj/Tp1cZNo3t+llsuAMjdpqSuw6cRUEM+/LzxhQX45cegY6/wH1TWEZY//FkjirkXbxhWsFyZkBbSlRyiNmlxK2O8wWU6RbNDRwggSwZ8NX2HRmM7+TxumMnFt2x2pu5YCAGztDNbEOp10b5uPtStWIT2wubpRdz8baXfdondvxUNOKGCOY7109i8tRT+mLfDASnfFfvXWPb5Q7p0sH6XgRE9ft/YfoVauoSHCIGWcZX9N13RF0lx4UBkte+F/UJTgRPnaT0I4wUClgmKJNgThbN8CaKhPkrzjAjehcolm4n4wiQxXdLEkoh3eAtDfSS/sw+IyAuNYwbc3YHHLPn7D1wtU7UuAACtPqYA/LcsIElZ9M5Ll/Rl5xTfnT7t6YPb5GtxcdUmg1mEWHQS0WPfpwas4ki7dfs/PPMZjM7+NCBO8mtzIv469WoyJXP3LSaOaV88FBrdRmqDRGAWck4sQBNIsW6HAN0M3bNNLo10cVrS4DM//eDCKApOumSe15LG3Qr1NgkhJa/F+t9a3fN1zSAGU3qOzxpv7mwtzeXESdgf+o5O54ROP1Ww1+PLVWKvQ4pM53xOXbNMCKpFSDA/0n/9siwREbYB+QrWb7D8/H5RRMTCV8rsoREdK2hh7nmhBJOX3/i7QcZ6xaR+e5WBF0jykkipMKpbLDviqaxm3vwHkFBb4p/ASaeM66fK2q35fxQNDEF9X59qwRk=
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
IPV:NLI; SFV:NSPM; H:BN7PR04MB4388.namprd04.prod.outlook.com; PTR:; CAT:NONE;
SFS:(4636009)(346002)(396003)(376002)(39860400002)(366004)(136003)(8936002)(38100700002)(6486002)(5660300002)(75432002)(86362001)(36756003)(31696002)(66556008)(66476007)(66946007)(786003)(478600001)(16576012)(2906002)(2616005)(26005)(8676002)(956004)(6916009)(83380400001)(31686004)(53546011)(186003)(316002)(43740500002)(45980500001);
DIR:OUT; SFP:1102;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?Windows-1252?Q?ntbDg0Q3NE67R8amI8gYH9mSrzTcx6AgOB20arJmLnPO8CG4lg1Lzh0L?=
=?Windows-1252?Q?SEGj0/O1ZEPWhEXO6mqUmv1obWIf1gAWtd2wNZ0laB5TwTn19gPnUaYA?=
=?Windows-1252?Q?Pentc3QxdmNm88mX6Zs0w44ILS6xPetq9HkOJ1RcTjRtCEIYAaaN0jAH?=
=?Windows-1252?Q?MFAJFV1I8R5EM1VChG2mMayzE+s14I0ozBxxqjBH1ZCLqMTDU3/4HnA2?=
=?Windows-1252?Q?iIS/zMpEhZHtraETiqabYcc4vPvgE0Mp1jq7OhPelmf6F5lUKYG/hxjI?=
=?Windows-1252?Q?2SXa/aVCpHk1Nwb3ZUvGt4r4ShxoKb/hgpltma0nLSU6InF3CIiwflSX?=
=?Windows-1252?Q?DG/djIZi1CSvuVUASdDAHNVqU+ikWh0qFOrpZqZXpBRJgAnLC9jVXhf+?=
=?Windows-1252?Q?xZ9gfvUZeky7uNnZpBHaEn5Hlleos3r0k74QNWslgPFr9VL9tNiwh/Yi?=
=?Windows-1252?Q?eY54OGocyEA9oOUR0eKn8FIGzGFQQndH9UppZUCveP8dGpZDIso6QqhH?=
=?Windows-1252?Q?Vu1TWMXQPAu3P1Wve+M75JCpVg/VD9aOHIlz5J7k1rfg0teERGTzhm4q?=
=?Windows-1252?Q?pujI5Y6ojXWlztiXukiArmGD/MzjIBJCAkcC/3LGKdJoknSpf3Zv/cYa?=
=?Windows-1252?Q?K32U7b5wkMPQFyzYSgISTGDJ1phR/JiyNCSg1LFp0iQwYvpRM4N1Ju5i?=
=?Windows-1252?Q?ZQPFVy4aUFExJyKaoG2g/htnmOXgSUL8f9SygYYqy3ilV+SPKBOdILbu?=
=?Windows-1252?Q?Zw5KdG2Ru+UYSyfLO8XtGS3mfAzoJgpRrnqpNBn041MjtvF9owxM1wyH?=
=?Windows-1252?Q?e/B0gYoJWdqlTYn3H5BmIXfU3kLO+/Wyo5BTPaAYwSt8nYozv/uU4HZV?=
=?Windows-1252?Q?FZyGlb4ZpLWr2pp/haEpuqfjaPg8UFD4WlSsVhSwnCQCuA3HKn/57SZX?=
=?Windows-1252?Q?aeCLSMq1FFqJBlyBe0jLuCJfrTS9QlJ0b2NGQkw3NUXhljV7PFwLlMuV?=
=?Windows-1252?Q?PDr+sadM2tGXORGGQow8ofhEU+1fjaCnteZO7CvZDfOylBKGWJBYa8eo?=
=?Windows-1252?Q?oylTkNpMnYzQMQoeBZrjWnCTeS1rwk8Xhf3Ko6Bo8KaIvpN6yMr0LLyA?=
=?Windows-1252?Q?SFHpXqKVbt1VZb748mq4QQOHtT2R+X7lsAg1hxh8951OIQMJ7uVnwp0S?=
=?Windows-1252?Q?bjiKu2nfExnQXUKSqkBI5jVXyExKz7hjMIGQ1sRfPgViGElkvr1p7PU+?=
=?Windows-1252?Q?uilAF8TwkdBQQ8SYTTMm9UQQVYSKu698Wkyyc/Gcq/jfSvdOOi86kgLW?=
=?Windows-1252?Q?bOM0O44jFyaQ49cgw5Lvwy+5sg591w8pz708OVTFmIXTHdWn4heiZsxo?=
=?Windows-1252?Q?DRgrd+jzODfqGKnbz7/1/iuW4GEEBVs1PV3qWzi54Bmks1Xkm450njCn?=
X-OriginatorOrg: cornell.edu
X-MS-Exchange-CrossTenant-Network-Message-Id: 1b9d57ed-6373-4e1a-5d7f-08d96b5c0a63
X-MS-Exchange-CrossTenant-AuthSource: BN7PR04MB4388.namprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2021 02:15:30.6302 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 5d7e4366-1b9b-45cf-8e79-b14b27df46e1
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName: 8rBJ6lGGlTTuqlqEb4WmzlW2KkOM4CGuOZWYAaDbruDCblp3+pT2BYbFt8XXH46GsZP/0n0W6vfc67inUDhnFQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR04MB6369
X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL,
MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,
SPF_HELO_PASS, 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: Ken Brown via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Ken Brown <kbrown AT cornell DOT edu>
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 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.

> Even without this problem, select() for writing pipe has a bug
> and does not wrok as expected. The following patch seems to be
> needed.
> 
> diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
> index 83e1c00e0..ac2fd227e 100644
> --- a/winsup/cygwin/select.cc
> +++ b/winsup/cygwin/select.cc
> @@ -612,7 +612,6 @@ pipe_data_available (int fd, fhandler_base *fh, HANDLE h, bool writing)
>             that.  This means that a pipe could still block since you could
>             be trying to write more to the pipe than is available in the
>             buffer but that is the hazard of select().  */
> -      fpli.WriteQuotaAvailable = fpli.OutboundQuota - fpli.ReadDataAvailable;
>         if (fpli.WriteQuotaAvailable > 0)
>          {
>            paranoid_printf ("fd %d, %s, write: size %u, avail %u", fd,
> 

I agree.

Ken

-- 
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019