From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2115.outbound.protection.outlook.com [40.107.93.115]) by sourceware.org (Postfix) with ESMTPS id 3D254385B831 for ; Sun, 29 Mar 2020 02:19:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3D254385B831 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WkgCOT/WQdGnAOSrVqw2Z/cLL3QP5f4s7uUuDNkBp4EMDh8PEENEcgFpT6ywVYXODOba7H88biP3A/ttqpKfk44MKUdWC0lWBHzIv1vgcgG5sdk+z2qUY1GAyczjzFy/8vQZInZy29GxA9QyTk+XMCaPdXrgwzk3DtHAOjEe5fib2ttvvVwNiZPvwsZXcEyj18m1nY8b3ZPfDBv7mzaM9gEDwbced9RZbvaw3P0Nc+1Hw/Y+Q1DXFQkwG39YXD9gv3XCbePEEI37rDR2rxLKeiysi2GgrUfAcQlFOyyk+wFGoza2UdakHgYfJJVFkpAUyPufVSQ9AzaAbqCmw0QiXg== 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=UyPFCAwZ+8GMc+cpkI127yzbVjhhfOdIEGKkCRWAtns=; b=jTlBMGNYBR72koU1TCDKZ1sdMM/Ea6T5MrNzLSSxsgfPFRYqqvu+O3tv5+v9c7RiiRxfLM8tOkbEvbqwu9WVlPBCQWl62KiVAeWzOPNRvEQSoGBy9WEb7PDL3KhYSAd3UhsYQJOMa+YVO0ufN2gmVv10szWUi8Ywh7V7xXl51GcJNM5ougKT/Pl6TyMuyWKlrMrA7IR1IMjIqwDMvPcg6p/l3WP7DCseG8Q4iVOJLRgfGauLPVV5MGSoWyihDmvLXKj48Y4xIif++aWMPRTpOLMf7pbH8AZw+mKNw9v0/TzaHHHXP4/tgL+kqwN8nPJADHSvR3/GPucwt95uzd/wcg== 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 Received: from DM6PR04MB6075.namprd04.prod.outlook.com (2603:10b6:5:127::31) by DM6PR04MB5145.namprd04.prod.outlook.com (2603:10b6:5:fe::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.19; Sun, 29 Mar 2020 02:19:12 +0000 Received: from DM6PR04MB6075.namprd04.prod.outlook.com ([fe80::e806:ecfb:c187:4e5a]) by DM6PR04MB6075.namprd04.prod.outlook.com ([fe80::e806:ecfb:c187:4e5a%4]) with mapi id 15.20.2856.018; Sun, 29 Mar 2020 02:19:12 +0000 Subject: Re: Sv: Sv: Sv: Sv: Named pipes and multiple writers To: sten.kristian.ivarsson@gmail.com Cc: 'cygwin' References: <1b1401d60296$2769e690$763db3b0$@gmail.com> <716e2076-f607-454e-2723-937c3959e2a3@cornell.edu> <18be01d602ab$0bbfca30$233f5e90$@gmail.com> <35b43b59-6410-f21f-710c-385e39cbae0b@cornell.edu> <005201d603ba$2bc8ab20$835a0160$@gmail.com> <472d1df6-531a-ebd7-4ffa-583a06e270ff@cornell.edu> <00b901d60447$7ecb4c50$7c61e4f0$@gmail.com> <00e001d604f9$d0aa0720$71fe1560$@gmail.com> <8c6c5655-c162-8361-9f44-376bbd7cf114@cornell.edu> From: Ken Brown Message-ID: Date: Sat, 28 Mar 2020 22:19:09 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 In-Reply-To: <8c6c5655-c162-8361-9f44-376bbd7cf114@cornell.edu> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: MN2PR18CA0002.namprd18.prod.outlook.com (2603:10b6:208:23c::7) To DM6PR04MB6075.namprd04.prod.outlook.com (2603:10b6:5:127::31) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.0.17] (68.175.129.7) by MN2PR18CA0002.namprd18.prod.outlook.com (2603:10b6:208:23c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20 via Frontend Transport; Sun, 29 Mar 2020 02:19:11 +0000 X-Originating-IP: [68.175.129.7] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 442a572b-a160-4954-2472-08d7d3879210 X-MS-TrafficTypeDiagnostic: DM6PR04MB5145: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-Forefront-PRVS: 035748864E 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)(376002)(396003)(39860400002)(346002)(366004)(136003)(4326008)(186003)(786003)(86362001)(16526019)(6486002)(6916009)(75432002)(31686004)(26005)(31696002)(66476007)(8936002)(478600001)(53546011)(66556008)(66946007)(81156014)(36756003)(52116002)(316002)(956004)(2616005)(16576012)(5660300002)(2906002)(81166006)(8676002); 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: jj9t33YXmcYm6FRJXok9iMt4ou51EMiN3HHqpozqP/ECHpS9TGAvNh7jd7K7uBj3trxeKW48FOckN6XjOUJaNH3xXmgW82wXafbsxiPKfxoCQwnoKh9D1mN2NE942WQirg3C4xZLnQlodavjyGVCW+yPg+tXaWkNo/iJwgk5laS+JzEpAK3KEEL1T8ml1fteU00napaHIV7kK2fCp1R4iPUehhiHYeETQ0HatYTJQ9RWUg85TwcRPbY2kadmdFKDnFRyM9bwh9naj/8Hj47lCHat49hCjG8Ys4v25UzsWooFcf04f/lH55Vst/1jOEIBgEqclE5OeX4CWvKxyrtQO6Wk02GhnG1BZ2BNFsmCL9fejdRp2YMvP3umht9vUhjUNEuDZKWyw9BNAFCcUbpqbddA2xRP1xMqPKjxC6hyygf82KmurEvzV2Ooz8u8YlRV X-MS-Exchange-AntiSpam-MessageData: aqNxEiWzZln3MCAq1M8n8q8h+FiDSOb1m8TtMJnhrTUNBUy05DV+Y17p2BJXPLbwe1S6o6QwqM4NLYM4cqOo8knL4OffiUd7OCcZ3dDqotG2geO8rHwxi20dPIBDFBUeGUqYQTZCVMJL5E52NV9wfA== X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 442a572b-a160-4954-2472-08d7d3879210 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2020 02:19:12.3130 (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: XFDRZNf49aV5eLm0iRyIAZwOr7wqp2GbBsvXt3/QMOvoW3oDxR5BAN2FZ0nP2fcN7E+aIj41qO5g2+biXw9L/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5145 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no 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@cygwin.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: , X-List-Received-Date: Sun, 29 Mar 2020 02:19:20 -0000 On 3/28/2020 11:43 AM, Ken Brown via Cygwin wrote: > On 3/28/2020 8:10 AM, sten.kristian.ivarsson@gmail.com wrote: >>> On 3/27/2020 10:53 AM, sten.kristian.ivarsson@gmail.com wrote: >>>>> 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.kristian.ivarsson@gmail.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 >>>>>>> fhandler_fifo::wait.  I have a feeling that read_ready should have >>>>>>> been created as a manual-reset event, and that more care is needed >>>>>>> to make sure it's set when it should be. >>>>>>> >>>>>>>> I could provide a code-snippet >>>>>>>> to reproduce it if wanted ? >>>>>>> >>>>>>> Yes, please! >>>>>> >>>>>> That might not be necessary.  If you're able to build the git repo >>>>>> master branch, please try the attached patch. >>>> >>>>> Here's a better patch. >>>> >>>> >>>> I finally succeeded to build latest master (make is not my favourite >>>> tool) and added the patch, but still no success in my little >>>> test-program (see >>>> attachment) when creating a write-file-descriptor with O_NONBLOCK >> >>> Your test program fails for me on Linux too.  Here's the output from one >> run: >> >> You're right. That was extremely careless of me to not test this in Linux >> first :-) > > No problem. > >> I can assure that we have a use case that works on Linux but not in Cygwin, >> but it seems like I failed to narrow it down in the wrong way >> >> I'll try to rearrange my code (that works in Linux) to mimic our application >> but in a simple way (I'll be back) > > OK, I'll be waiting for you.  BTW, if it's not too hard to write your test case > in plain C, or at least less modern C++, that would simplify things for me.  For > example, your pipe.cpp failed to compile on one Linux machine I wanted to test > it on, presumably because that machine had an older C++ compiler. Never mind. I was able to reproduce the problem and find the cause. What happens is that when the first subprocess exits, fhandler_fifo::close resets read_ready. That causes the second and subsequent subprocesses to think that there's no reader open, so their attempts to open a writer with O_NONBLOCK fail with ENXIO. I should be able to fix this tomorrow. Ken