From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2116.outbound.protection.outlook.com [40.107.94.116]) by sourceware.org (Postfix) with ESMTPS id 21A73385E010 for ; Fri, 27 Mar 2020 23:00:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 21A73385E010 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bPAdskLq3gyQ0hgFDmeSeYRissjvep0uglm/wilkPRqTC7nlZDHwxXtAG3hzDS4H0+Zxs+whI3zEw0txaSygOvJCITAa0jF812EZmo3Ws7rMdD+qOgP8c9nbCjZhJMgODmNPDgcp/5lbUVjBZo0jbRDbVrEazXqUhG6Hx6xAu/UmYSUcsj1G18hoUXcImRhckEAvL+IeltWOX4EdULy+elfok8+FITYib5Bp8CJQ2E1l6Gv0GDO0igM/MyejmwFlML1sSD1wPx7p5a7001RnsXBsCG7BwvooPeSqtTljAVB04HcgTYmItxwPngHkh5SGNHn7qyuUN/+o1jVFt5UOiA== 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=1fYyKfRGtStRufLtPwEs39Ta9Um95HpNqjqDO9zfIXM=; b=SFOer7A90Neh8GJ2uCN3PzYyKa0HMG27PtqowfQcY+Wy8wIbk4OGeZA+8wwVgVMiVmfz4FpMJkfAzK1wLPbzpCYrfapK3Htuz5a8JvGzBJthZQEvAjeBrlA4mx5rt3kWbKIk0TMuuyY7rlCNSIoYDDix7374UhoeEN9krUbEVAj/E5a/HYoNesbp1Ynn9NqBxT2Z9RmK2ZrZQ8g3Oh/UT8/T7KbF2XuyRQv/Pj42QfxvwYtBTRhcC20ED/MxqqIQxuseL9IdQFGbpbTGeOKNmlZhRHowF8RhfXCYwloZKDxFgHt2z4Rf2mRatI+xLzSuYWv8jjFBI4jynNWeMdI6Eg== 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 DM6PR04MB5515.namprd04.prod.outlook.com (2603:10b6:5:12c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.20; Fri, 27 Mar 2020 23:00:10 +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; Fri, 27 Mar 2020 23:00:10 +0000 Subject: Re: 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> From: Ken Brown Message-ID: <917871e6-d85c-60cc-6501-5d4ad0104f92@cornell.edu> Date: Fri, 27 Mar 2020 19:00:08 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: CH2PR07CA0031.namprd07.prod.outlook.com (2603:10b6:610:20::44) 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 CH2PR07CA0031.namprd07.prod.outlook.com (2603:10b6:610:20::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20 via Frontend Transport; Fri, 27 Mar 2020 23:00:10 +0000 X-Originating-IP: [68.175.129.7] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c2060c51-5812-4c96-4ac4-08d7d2a299e8 X-MS-TrafficTypeDiagnostic: DM6PR04MB5515: X-Microsoft-Antispam-PRVS: 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)(376002)(39860400002)(136003)(396003)(346002)(366004)(8676002)(786003)(31686004)(81156014)(186003)(26005)(66476007)(16576012)(81166006)(75432002)(66946007)(8936002)(2906002)(478600001)(66556008)(36756003)(316002)(956004)(2616005)(16526019)(966005)(86362001)(4326008)(6916009)(53546011)(6486002)(5660300002)(52116002)(31696002); 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: 4oq83BbHr6Y8E3ojLeEgyL0qk9nFjkswRv9nyQq4H9ZyiMPuTgB3fEdzngKHqeYYcwkY3EfAZ695olFvKpfzpcHbKSw5/UJhm86bOMsLu68AvnSo+syJS4bgQAuOWkiOMD846wvZ7rwSD8hC5Oz70Mh8UN0kn6WF5pqwdSWhe7DU8s/bGEAcD7+KJTgLHZ1cSRTYPerbTWwL+f3awD/4h0aJx7NQC9nYZbRZ5W0xIabdqautPH3IdiA88hIO70YD12PFnDDo+c8hUxo5JikQKsH4XHat4E4NC3+oguzMKI4xneAdM1iRu5f1MK4ZcRpVjFjQAxtB5o9DHhkqFcgcE2IbqIqKY2prbK4DVssDxHgiVefEoYQJSnGQjt7AQXfZjxv/yR7klH/5IiXTrWnZSsaNvn+4zvEdJYWkZEXT/G3eDSoykl/PoAY50Lej4+3XOwFcSBALmMG2Ki9iFDuw2PIumifH4Sl9s+jGrYI3HKiQ00xrT7JL+FDDB00h0GMSQ/U36aXbAbSkn5CVsJ+0Yg== X-MS-Exchange-AntiSpam-MessageData: 2B1vnHIOtuzkwMERASqwkTPJSHoUwS/+zzSyKrdZ6yKOk0V+3+5idQlm4TrQoUoZSRdL3CLLzrlDwBlrkEDEo4p207Bvx6qrtG86cu9lbV5uZ0tOv84FYiGX+xNyoF/Q0N5nDrh0TJ1JXbwfQFYmsw== X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-Network-Message-Id: c2060c51-5812-4c96-4ac4-08d7d2a299e8 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2020 23:00:10.5816 (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: +9RWz9HBQqZi4y9Hj3bRagk26MXxG7nBdRGOD/Wl7YMsyuOq8iYW3e8+DBDvxJRkMVYaFrxnBy1sRpQ/dSLDGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5515 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, BODY_8BITS, 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: Fri, 27 Mar 2020 23:00:13 -0000 On 3/27/2020 6:56 PM, Ken Brown via Cygwin 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: > > child 657 > 657     error:  6       No such device or address > child 658 > child 659 > 658659  error:  child 660 > parent > child 661 >         error:  66606661 661 661 >                 error:          661 > No such device or address6No such device or address > > No such device or address > > [I then killed it with control-C; the parent was blocked trying to open the FIFO.] > > There's a race condition in your code.  The parent is trying to open the FIFO > for reading (without O_NONBLOCK) while the child is trying to open it for > writing (with O_NONBLOCK).  The parent is blocked waiting for the child, and the > child's open fails with ENXIO; see > >   https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html#tag_16_357 > > I think you need to rearrange things so that the FIFO is open for reading before > you try a nonblocking open for writing. For example, you could open it with O_RDWR instead of O_RDONLY.