From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 124235 invoked by alias); 6 Jun 2018 16:23:54 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 123099 invoked by uid 89); 6 Jun 2018 16:23:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=inconsistency X-HELO: mail-oi0-f48.google.com Received: from mail-oi0-f48.google.com (HELO mail-oi0-f48.google.com) (209.85.218.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Jun 2018 16:23:51 +0000 Received: by mail-oi0-f48.google.com with SMTP id d5-v6so5804391oib.5 for ; Wed, 06 Jun 2018 09:23:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=4YZ1MtVMBRrB5zWQ0wPDCO6WteOBZc7657n+shAmqpk=; b=rct0DYJjD4VyYe6uc6T8SHac6oOyzILpR3uFUO1ZEjQRgB96gBYcLHTHrX/oBKk8R6 2Uuiz9OEtBWlIJlvDz6WH/aZw1fN2W5wVTktth3estu7uixKXpCYbbxZIYwHeDIneabp HpVnww4FO2l/FfwPdut4BY6X9FqkpS18pF1yOQXk+nEv6nfQqwHkSb4luaxg9RgviGKD QuO7Fw4DeplyNWHzUyBRYg6MkcYP1lUDeIunZNCP7qNcs9AoP9UuL/SfKDSKsvgFbaR2 +3sTpApM5rGz6hcNk2W/zHbKuqKquuPaezFOifY0D+CcRysgmpokOsffEed8dze2BJRo xOrA== X-Gm-Message-State: APt69E0SDAfx8OUJZPbdl/SiKug3ySU0JY0qcJ9p4yN2dc34giUqwk8e AIvm2lzRNYRZnIUgYq4AfElGQjJJN+zLBVk12xUT0xQ= X-Google-Smtp-Source: ADUXVKK2IXk79HoF58Zgj5tnbAhye4hMvuOKIA547bfz4FLiZarlw8V5sVb3P4suqD3DGQBDyo1vmfEY7oMnRiRR3rY= X-Received: by 2002:aca:f186:: with SMTP id p128-v6mr2138571oih.286.1528302229003; Wed, 06 Jun 2018 09:23:49 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:522:0:0:0:0:0 with HTTP; Wed, 6 Jun 2018 09:23:08 -0700 (PDT) From: =?UTF-8?Q?Jo=C3=A3o_Eiras?= Date: Wed, 06 Jun 2018 16:23:00 -0000 Message-ID: Subject: Multiple attempts at opening same pipe for writing fail To: cygwin@cygwin.com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00065.txt.bz2 Howdy. I've prepared a testcase for a bug or inconsistency with linux that is affecting one of my projects. Basically I have a background process that keeps some state always running with a pipe open for reading requests. Foreground processes that try to open that pipe for writting (to send a request) then block/fail on the second and subsequent tries. The whole setup can be simplified with a small testcase that runs in a single process. https://github.com/joaoe/cygwin-pipe-testcase I left a README that explains things in a bit more detail. To summarize here, consider the following order of events: * open pipe for reading with NONBLOCK into FD1 -> OK * poll() FD1 -> empty event list, OK * read from FD1 -> zero length read, OK * open pipe for writting into FD2, write something -> OK * poll() FD1 -> POLLIN and POLLPRI, POLLPRI is unexpected here, FAIL * read from FD1 -> got stuff that was written * close FD2 * poll() FD1 -> POLLIN and POLLPRI, wrong, should report POLLHUP, FAIL * read from FD1 -> zero length read, OK * open pipe for writting into FD2 again -> got error ENXIO, FAIL So, known bug ? Do you confirm my observations ? Any pointers so I could perhaps look into the relevant code ? It seems like Cygwin still keeps some dirty state somewhere that tells the pipe is still open by a writer somewhere. Thank you ! -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple