www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/03/27/09:11:15

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1519A385E015
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1585314626;
bh=72OUWlI3FViO5azrnNMyqZJBvHDtkOrYrgUitGUpuzM=;
h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=fO0T7wD1dAoka7TuALIPMjX25UEZdTs8ZQwIaIi9oy3aQ1Cwn1OhzPYt96eB1iN96
oEB2bLbyQ4cYM4+2CXQk7vVZim0DC78ZXy+Wth2frlNkpNupThfuu2cMbAkGTutr+d
Hm7mlm0g4cBUZ5Q3QxpWVGODSz1+e07Ijvw0gSfc=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7EF10385E006
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=Gg1bKB0k2CfvH0OH6fp24JE0YAkxnyT1qq9X0ZlQ45UAbWalQb7mgZWwYMFtsjO+XKQPDE3AWcprjDQ3mVqyUU9iJDJfyWq0FSZOldgxSejxFl4ovGpFc1doektA8IsKZtBsoDdY14bHyxgS3+c2xEpAkzbEB4KHbzWTDyN9nt6MJHr2xv/E5Ff6kPT9ejhGbhGkOJindxSHMB7VbolLTX5sEkb3v/ZThSUDiMoSPvY8qHTmJ0cBi37KzzP+sViOusuya9Ovgi6/2rqp7Bg/Df9hwyAxSth9k+HJxaxbC/Yte7J5js2rt0ewxZgQHoSw/UbeaO+CEWlqgvaPCIKC5A==
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=+Acx76onOExFWoq3sqqEhLs0blnFN3NN+1VlLt2CPYM=;
b=Pb1ma8uWjSuWojK1w97vVkxyejiIzz+dDYHRC/WACU4Bp4u3a86MRzKG0fRA2j48LPN6Rn0BRmyPL5/XATv1w4DrJU5NCbhEjzrQIqQVkdjIYL+xD4q2qVvtXIoLERj87au/6PSmFyucEl/2mbybQLxvJ5dNS6dk2WV1TuBKFTT7INh8UXxqIlvITTsT6Pr3UGrYQVSqMs/uO9oyyLeN2hfQ3jQbmPZUtUuRPebz8C62RROROzqvr3As2GxSmi3b4VekA+o892rkyjdRNcnVHm0sMi3FJVFp55YlrKZynv7FfMZv/bWi2wYPpGeVimajUJGP3jenfQwK++Y09EE7ag==
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: Sv: Sv: Named pipes and multiple writers
To: sten DOT kristian DOT ivarsson AT gmail DOT com
References: <1b1401d60296$2769e690$763db3b0$@gmail.com>
<716e2076-f607-454e-2723-937c3959e2a3 AT cornell DOT edu>
<18be01d602ab$0bbfca30$233f5e90$@gmail.com>
<35b43b59-6410-f21f-710c-385e39cbae0b AT cornell DOT edu>
<005201d603ba$2bc8ab20$835a0160$@gmail.com>
<472d1df6-531a-ebd7-4ffa-583a06e270ff AT cornell DOT edu>
<ce4a4877-df77-3400-e8ac-16655b313757 AT cornell DOT edu>
Message-ID: <b311d907-7376-5bc6-3216-7d2b96728dbc@cornell.edu>
Date: Fri, 27 Mar 2020 09:10:18 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101
Thunderbird/68.6.0
In-Reply-To: <ce4a4877-df77-3400-e8ac-16655b313757@cornell.edu>
X-ClientProxiedBy: CH2PR02CA0005.namprd02.prod.outlook.com
(2603:10b6:610:4e::15) To DM6PR04MB6075.namprd04.prod.outlook.com
(2603:10b6:5:127::31)
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
X-Originating-IP: [68.175.129.7]
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: fec0b262-1478-4de9-f0e6-08d7d25033ce
X-MS-TrafficTypeDiagnostic: DM6PR04MB6153:
X-Microsoft-Antispam-PRVS: <DM6PR04MB61535508F75732069AB60686D8CC0 AT DM6PR04MB6153 DOT namprd04 DOT prod DOT outlook DOT com>
X-MS-Oob-TLC-OOBClassifiers: OLM:6430;
X-Forefront-PRVS: 0355F3A3AE
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
IPV:NLI; SFV:NSPM; H:DM6PR04MB6075.namprd04.prod.outlook.com; PTR:; CAT:NONE;
SFTY:;
SFS:(10019020)(4636009)(136003)(366004)(346002)(376002)(396003)(39860400002)(5660300002)(956004)(66476007)(2616005)(26005)(6486002)(6916009)(31696002)(66556008)(66616009)(66946007)(31686004)(16576012)(75432002)(478600001)(786003)(16526019)(2906002)(186003)(81156014)(235185007)(4326008)(86362001)(36756003)(52116002)(8936002)(33964004)(316002)(81166006)(8676002)(53546011);
DIR:OUT; SFP:1102;
Received-SPF: None (protection.outlook.com: cornell.edu does not designate
permitted sender hosts)
X-MS-Exchange-SenderADCheck: 1
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: ldcahjWmAFGUIdqdkmIO/yo1VbGIf+TkulVnL0RcFSjA5sjVaqe48HG4lrqXjwKOJxYWsyG6qf4XQ3xFRrpOFea5xe/Blqh7zgLfzNsol00+Ztl0e7H6jleb9cKkvIfxxeIv1weqXhV2NfRjo5j2MLm2cKxRYkxqNXb2BoUVMxImVZkNZ36JJCABgah4nAavSo9je3LpHapiKDL9M6JqT4JXAMrDEBx7wCsAUh1vX/zE3NiXb7EoRbTukhOnClIuLrpOkDw4sQBlhER4My/hR+c1DEcOaPhp272Fk3rwq13Ri86EVIZrr4mNEQdBUaYPwuN12FxjMf8Gia1UHklCR1M6Jdb1rBwtNhEjCFGsXBv2qMBJHGFRGpu2nLQPphx6OgPpNlyokeVRnqs1VZozneBk5LTyPsDNPXF5rnczCuOwOBkV35gTeM9PxOG7ZsJx
X-MS-Exchange-AntiSpam-MessageData: FjJ3/163iwx8VNXK4kkT1vl0M6EUHDu3nu2nL+m2/5Fx8CrXow11Ns6GjFQYsBnJvmkK/ecqVuUy44gwjS+NedZFFDG0kygpKtWu7B0qTcSkv8XuqR7BywGjO1ifNl+auwC5Uqj+9UW0HZnuF0DHlA==
X-OriginatorOrg: cornell.edu
X-MS-Exchange-CrossTenant-Network-Message-Id: fec0b262-1478-4de9-f0e6-08d7d25033ce
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2020 13:10:20.6430 (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: Eg+m5lMzVJa8qlRXEXgiZ4xRhNGkT+r3Pe3gjdn1ahOTaC8aCXbOlfWashv57narOJXHBi7IXvEslgTLHZik/w==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB6153
X-Spam-Status: No, score=-21.4 required=5.0 tests=BAYES_00, DKIM_INVALID,
DKIM_SIGNED, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,
KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,
SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: <http://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <http://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: <http://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>
Cc: "'cygwin'" <cygwin AT cygwin DOT com>
Errors-To: cygwin-bounces AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>

--------------9DB4FFBDE778189EE35BE0FD
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: quoted-printable

On 3/26/2020 7:19 PM, Ken Brown via Cygwin wrote:
> On 3/26/2020 6:39 PM, Ken Brown via Cygwin wrote:
>> On 3/26/2020 6:01 PM, sten DOT kristian DOT ivarsson AT gmail DOT com wrote:
>>> The ENIXIO occurs when parallel child-processes simultaneously using
>>> O_NONBLOCK opening the descriptor.
>>
>> This is consistent with my guess that the error is generated by=20
>> fhandler_fifo::wait.=A0 I have a feeling that read_ready should have b=
een=20
>> created as a manual-reset event, and that more care is needed to make =
sure=20
>> it's set when it should be.
>>
>>> I could provide a code-snippet
>>> to reproduce it if wanted ?
>>
>> Yes, please!
>=20
> That might not be necessary.=A0 If you're able to build the git repo ma=
ster=20
> branch, please try the attached patch.

Here's a better patch.

Ken

--------------9DB4FFBDE778189EE35BE0FD
Content-Type: text/plain; charset=UTF-8;
 name="0001-Cygwin-FIFO-fix-a-problem-opening-nonblocking-writer.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0001-Cygwin-FIFO-fix-a-problem-opening-nonblocking-writer.pa";
 filename*1="tch"

From 3efd5a8cbff8d48b8cf9807070134bb79f591b7d Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown AT cornell DOT edu>
Date: Thu, 26 Mar 2020 19:02:16 -0400
Subject: [PATCH] Cygwin: FIFO: fix a problem opening nonblocking writers

Make read_ready a manual-reset event.  Previously, when it was an
auto-reset event, there was a brief period when read_ready was not set
after a writer opened.  An attempt to open a second writer during this
period would fail with ENXIO if O_NONBLOCK was set, even if a reader
was open.

For the same reason, move ResetEvent(read_ready) from
listen_client_thread() to close().

Addresses: https://sourceware.org/pipermail/cygwin/2020-March/244201.html
---
 winsup/cygwin/fhandler_fifo.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc
index 19cd0e507..c7e27e883 100644
--- a/winsup/cygwin/fhandler_fifo.cc
+++ b/winsup/cygwin/fhandler_fifo.cc
@@ -463,7 +463,6 @@ fhandler_fifo::listen_client_thread ()
 out:
   if (evt)
     CloseHandle (evt);
-  ResetEvent (read_ready);
   if (ret < 0)
     debug_printf ("exiting with error, %E");
   else
@@ -516,7 +515,7 @@ fhandler_fifo::open (int flags, mode_t)
 
   char npbuf[MAX_PATH];
   __small_sprintf (npbuf, "r-event.%08x.%016X", get_dev (), get_ino ());
-  if (!(read_ready = CreateEvent (sa_buf, false, false, npbuf)))
+  if (!(read_ready = CreateEvent (sa_buf, true, false, npbuf)))
     {
       debug_printf ("CreateEvent for %s failed, %E", npbuf);
       res = error_set_errno;
@@ -1016,6 +1015,8 @@ fhandler_fifo::close ()
      handler or another thread. */
   fifo_client_unlock ();
   int ret = stop_listen_client ();
+  if (reader && read_ready)
+    ResetEvent (read_ready);
   if (read_ready)
     CloseHandle (read_ready);
   if (write_ready)
-- 
2.21.0


--------------9DB4FFBDE778189EE35BE0FD
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

--------------9DB4FFBDE778189EE35BE0FD--

- Raw text -


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