delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/03/27/18:57:06

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 76989385E017
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1585349777;
bh=08KYoAM8CSlUnLKAL9k0SKHoE+st79u9DZGpCTvUC+k=;
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=n6apyLT3vMyPpA3zmDFDkfL6ijl66lVwvsxzoXZvFvR+z9b3oT6+XZUSjN3s4nNE7
/EQDg494oik4kvkE7AS+mi9g9NEALUzGevC+B6/AuiOqCU+sf4Ny/R3PGw4tN1+W5S
LbXVAi5AkDUw7FdMl449QgGH+YgyJnEvD46H36xY=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BDBB6385E009
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=gxMNh5jXmbYG1BQbLn8umewgf7Q/Wtfv1cRRNoX03LcwEvMRPNf31rGDsY5I0GI/7rN1GR4XRvEHZsUOyUD6zo+YYTxNE3rzH2suLMLBgpRTlDMXXG/wXpFxvOoFgav12bdNCPQiaNuNEwqSGN8tmeNHGVrrBHxL1219jLHEFJx1BQXix51Zy0CSsV4o8YdBiRQmf7gEW1gbkchu2Jh/qGwsBRQwIQ4WdLaZdY1jcB+dNbXKdAJLhQQ1SwVCNhzwP2ZdJGeJ+MGY6GG08ihLftN0BRyxTAdghqj1h2JYouuSkumHg/tjtZxSLYs+0AfqkHJ0WndrYTIuIngV/Bzn5A==
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=jY5lESNK3tmVgyO9dPTvNlLeWXNpwvWU+asIf5qAygA=;
b=IbSnx3UnkxIef/VJkmSn3swPQGUyn8tTeQohFmJwUKjRQy1JGZupYsDixxvjqXjLKxiPaOidr3c2oDLslBC2rJ9W5vVh2wqcM+Ghozjf50I6o6qG8eIzV8SXIBSPEqQRsF9ouipHnO0yIAZZVSRV6Bd7tz3BEilsU/Ek0xB6CSWBUTWruUqtZnhqDdgRcVNYYD2wJzkYfTw+yBeg1PeTssqknNgZpWlGd9dMI1gH1kf7Z8fi4P0ua0kvbMhpxxZ6fnKMUCl2YlnCFab90OgzIarF//DYOmzQPDhNyZtnhFydXHTx0H71HWI0VGFNtHo9pnJjLX9G9seLHKmb7cHV2Q==
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: 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>
<b311d907-7376-5bc6-3216-7d2b96728dbc AT cornell DOT edu>
<00b901d60447$7ecb4c50$7c61e4f0$@gmail.com>
Message-ID: <f8f5c9b4-9eb9-85b0-ab8f-44b3b2458e0b@cornell.edu>
Date: Fri, 27 Mar 2020 18:56:09 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101
Thunderbird/68.6.0
In-Reply-To: <00b901d60447$7ecb4c50$7c61e4f0$@gmail.com>
X-ClientProxiedBy: MN2PR17CA0022.namprd17.prod.outlook.com
(2603:10b6:208:15e::35) 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: 619d8845-719e-4833-a0aa-08d7d2a20bb6
X-MS-TrafficTypeDiagnostic: DM6PR04MB5515:
X-Microsoft-Antispam-PRVS: <DM6PR04MB55154CD971FBC486B1A18716D8CC0 AT DM6PR04MB5515 DOT namprd04 DOT prod DOT outlook DOT com>
X-MS-Oob-TLC-OOBClassifiers: OLM:7219;
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: nN0E3DjxZjop4+pFrYOvlQ0x/lg07fFhMtH9rIfrFTx2cweTa9PsEjyhrIqR+/U6v1cIsM7r2djYdBHFWncPU07T2IVXuQnRFM0XJmHW96iZvlhBt4r3K25i3M04UfEWAZh8/rmGTw0ffEd/hEc7/Xp+ZqFBvMjDDmzhYoVwT4FDof0w2ZWRh6Ktdmm4zZUxnNWXOaR19uVBkLPN/5b4lyAXT7QVkk1I+tTy2PElyb5DpnCeiN0672QA1xEMS+IhhVCLpFfEN+NvnotUKZLLL5snNYOqo7w7FhndUxDdRm9dMJAGwExuTlTVBwLZ4ZaKaQuD68SseXvIUx+QVz2RdPzglzW7mmSP5ph45TubbihtiqH8nEVmV0i5W4lHUao2qc00ie/0vwV9tysBL4OV/AgCSQoavP00oSRsrzEzo+sqMhgNl8Vj6mlw2EGNl5dOTSCMKdq+deXVNe4089oJZPX1SBGZNT8kEc/+xyT3MQKWTZWjeEjw5A9YplBCshM5GZ3XEG7d4wlRdwYmeNXjCg==
X-MS-Exchange-AntiSpam-MessageData: MBOZ4lEhecRGRjmLVHd2a1MddYTzUWBTifeXdajE1Kp2h/MApR0oL5MJgwp+ZFk8vCse9kcfbnfG9/mdc0/0LQocd8if9MQDNliTdkH7zWtmntzZlW5Uqiyy6Ll096szGt8uTAUBL6fbIowV4uxyBA==
X-OriginatorOrg: cornell.edu
X-MS-Exchange-CrossTenant-Network-Message-Id: 619d8845-719e-4833-a0aa-08d7d2a20bb6
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2020 22:56:12.0866 (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: 74itDjydu5L8L9Fvp40ewlQNsRjsRSum5Ufj1GkFk2a5LT6+/n81hwtipDRoOfBWwCcc4sD2G9d0CLjq6LXo9g==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5515
X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, DKIM_INVALID,
DKIM_SIGNED, JMQ_SPF_NEUTRAL, 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 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>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id 02RMugb9028618

On 3/27/2020 10:53 AM, sten DOT kristian DOT ivarsson AT gmail DOT 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 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
>>>> 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.

I can work around the race by using a small positive 'wait' in 
fhandler_fifo::wait(), but I'm not sure this is the right thing to do, since 
Cygwin aims to emulate Linux.  Can you find a test case that works on Linux but 
fails on Cygwin?

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