delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/03/31/18:03:39

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92B1E385DC02
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1585692166;
bh=2L1V4NOSRr2cDfEv0/LoSrckH34DGGZ4roYUH3sA61Y=;
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=jbt3BVBHjT2+Fz8g8h7x4Vebc+gDJ8+oQwhL1yPZ7fdw72unqxWe2ndKnnSLd1x5r
ZDPfSjIIZOg89h1DvoWKugVjrinLBOc+B4mypIl8IvTBzHgCeCm3nheM1kvZ5Ze6sy
qYwHVl2FjQYqmktu0lnoEinTh9INjEZA5XENHrXw=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5C436385BF83
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=P604fV1k4/pscnmV8KDkE0x1C40eN0R8+dRfCsmZRkJxLu2dE39BLt8F9Vs4IbbhoN2Gdr46lXXBSqOyFuUtDS2UMs1Sw7OCZS8Y+4k0zzLoJhrVA9+IlVxvmw+KAioJyUk4lP9OQr4pzxrKN4paSTVxGL9787a69cPLHAAeS6k4rECN82nZfWwYzZWL/O3MkTpbxU0o5AJrGTgkuokUgcP8BBYoFwju58ywBi1DDTJqs5EpQd+BwSzkdXurhAUC8jjo2diZz2U99w0itaLWJUxh0c2yxTXo2ee3G96VTSbDhjNYbDHAVPUHmp5CufTMJ/lwJJugTb7Yf/Q9j7Dgiw==
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=faXhCjSiX4OXBAzjdzUmZk/gQbsL3d/qv5CayC85jvI=;
b=GsCRQs/VebFvZVuRt34Q5St29U1xRysDivKhYjMvRPQqOEfwt6YO5Svn6HCvdqLseGLhImxkYQrlMpXclsmFRQb1JxJuJNlIMV2SEU0ANbeUrgbVPj2M+5ImysyRTkSQlLIyPv5fPUGbmm1lLpenVbxo5lnj2EiZUf0fd6M+MEQ3cFeTKqOwqN7ESPIMSmlEpFWCcVgvQGxacYP77R63S7NikdG5zknGIRrcdaGkwsFzH9WBzaVcGZk2LdlgbvQ/uHKcOg1Fop9Xppdab8Li+eevbqyzEeqlXxwcijy80p6LSBzj4ov2t8kxewOUoAz2TWjn38nDsmqtzRUFHS7kWw==
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: 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>
<f8f5c9b4-9eb9-85b0-ab8f-44b3b2458e0b AT cornell DOT edu>
<00e001d604f9$d0aa0720$71fe1560$@gmail.com>
<8c6c5655-c162-8361-9f44-376bbd7cf114 AT cornell DOT edu>
<d213c473-00c2-0308-b720-d8f274126681 AT cornell DOT edu>
<3fe06192-7300-382a-8c98-f1bc2ff81e36 AT cornell DOT edu>
<003701d607a0$c975f140$5c61d3c0$@gmail.com>
Message-ID: <249be61e-da8a-7da1-ca67-0c4c6433a415@cornell.edu>
Date: Tue, 31 Mar 2020 18:02:38 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101
Thunderbird/68.6.0
In-Reply-To: <003701d607a0$c975f140$5c61d3c0$@gmail.com>
X-ClientProxiedBy: CH2PR18CA0048.namprd18.prod.outlook.com
(2603:10b6:610:55::28) 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: 08d32335-e6a2-4356-5cb5-08d7d5bf3b83
X-MS-TrafficTypeDiagnostic: DM6PR04MB4138:
X-Microsoft-Antispam-PRVS: <DM6PR04MB4138FF6CB168D8D5F0C35B72D8C80 AT DM6PR04MB4138 DOT namprd04 DOT prod DOT outlook DOT com>
X-MS-Oob-TLC-OOBClassifiers: OLM:8273;
X-Forefront-PRVS: 0359162B6D
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)(346002)(39860400002)(366004)(376002)(136003)(396003)(52116002)(66946007)(26005)(186003)(31686004)(66556008)(5660300002)(16526019)(66476007)(81166006)(53546011)(36756003)(8676002)(2906002)(8936002)(6486002)(2616005)(956004)(478600001)(81156014)(75432002)(31696002)(316002)(4326008)(86362001)(6916009)(16576012)(786003);
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: opI9LWD0LWN0zeEw3ZGn07rlmrTWRphxd1lEBdWMron7Ce+8Bg4XAlImTg2QIlHJbkll5XUYt0JW23WwyWuEOSFeeAhysMh/EdXDso7OD0RlIC2X/jXICXxTN+XMYgoTuWeMkPKnJtPzyHlLEtz9nKSBSi7zVhM729kkbILOF+NK8/5/B6GuQ+0IHaIYigodjkMWHQO/EAaNAshxdVTREsVwxlRwo07BQNw1ejPn8a272nHRgyQVWkznMDL5RbmPppXn+cE1YnuyfydTJ74g9lTb6roR/41wtP7gSUPt8tEYaoA9fZ2PvfgPxZOeX+vBRP4rtIwVEYvki+4Q0Wkf9XibQomAfJ6zFqg6o9Pam7xOknNxSvvQ0MwEzFycDZspVpGsNRLf7OpNQ4dgbMYYEMtHBx/W0Eo3X9DmHEawSg4jbKKF0Cb3Y6Rizkbmcz8g
X-MS-Exchange-AntiSpam-MessageData: gXx2O5zRQum/QMs+aaTdUY7AV1aHBaSmyR0cdC30oTEDbUPvwjc4SvCBuYvgsuEWtzJAUj9hssC4ZQkFtNnPlI24tJHRFTXtcSYsN2Zg8PqGfNTOyqtOOmXST++5dxAYyFU13uCB9TYbPBac0vw7XQ==
X-OriginatorOrg: cornell.edu
X-MS-Exchange-CrossTenant-Network-Message-Id: 08d32335-e6a2-4356-5cb5-08d7d5bf3b83
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2020 22:02:41.2127 (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: 1K8GL1YIK/KAEIG2mo+WGhjeHtYgFvEDuSpJ9fo4fXajOi1YIn6HUQgGe1y+GoBUOGakYWTJxxETh5cz5uD6sQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB4138
X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, DKIM_INVALID,
DKIM_SIGNED, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, 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 02VM3EbD030334

On 3/31/2020 5:10 PM, sten DOT kristian DOT ivarsson AT gmail DOT com wrote:
>> On 3/28/2020 10:19 PM, Ken Brown via Cygwin wrote:
>>> On 3/28/2020 11:43 AM, Ken Brown via Cygwin wrote:
>>>> On 3/28/2020 8:10 AM, sten DOT kristian DOT ivarsson AT gmail DOT com wrote:
>>>>>> 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:
>>>>>
>>>>> 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.
> 
>> I've pushed what I think is a fix to the topic/fifo branch.  I tested it
> with the attached program, which is a variant of the test case you sent last
> week.
>> Please test it in your use case.
> 
>> Note: If you've previously pulled the topic/fifo branch, then you will
> probably get a lot of conflicts when you pull again, because I did a forced
> push a few days ago.  If that happens, just do
> 
>>    git reset --hard origin/topic/fifo
> 
>> It turned out that the fix required some of the ideas that I've been
> working on in connection with allowing multiple readers.  Even though the
> code allows a FIFO to be *explicitly* opened for reading only once, there
> can still be several open file descriptors for readers because of dup and
> fork.  The existing code on git master doesn't handle those situations
> properly.
> 
>> The code on topic/fifo doesn't completely fix that yet, but I think it
> should work under the following assumptions:
> 
>> 1. The FIFO is opened only once for reading.
> 
>> 2. The file descriptor obtained from this is the only one on which a read
> is attempted.
> 
>> I'm working on removing both of these restrictions.
> 
>> Ken
> 
> We finally took the time to make some kind of a simplified "hack" that works
> on Ubuntu and BSD/OSX but with latest on master newlib-cygwin gave "ENXIO"
> now and then but with your previous patch attached, there was no ENXIO but
> ::read returns EAGIN (until exhausted) (with cygwin) almost every run
> 
> I will try your newest things tomorrow
> 
> See latest attatched test-program (starts to get bloated but this time more
> C-compatible though:-)

Thanks.  This runs fine with the current HEAD of topic/fifo.

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