From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102622 invoked by alias); 13 Jun 2018 15:44:12 -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 102612 invoked by uid 89); 13 Jun 2018 15:44:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=affecting, Multiple, H*F:D*ne.jp, HContent-Transfer-Encoding:8bit X-HELO: conssluserg-02.nifty.com Received: from conssluserg-02.nifty.com (HELO conssluserg-02.nifty.com) (210.131.2.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Jun 2018 15:44:09 +0000 Received: from Express5800-S70 (ntsitm315127.sitm.nt.ngn.ppp.infoweb.ne.jp [125.3.30.127]) (authenticated) by conssluserg-02.nifty.com with ESMTP id w5DFhuTC008299 for ; Thu, 14 Jun 2018 00:43:56 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com w5DFhuTC008299 X-Nifty-SrcIP: [125.3.30.127] Date: Wed, 13 Jun 2018 18:14:00 -0000 From: Takashi Yano To: cygwin@cygwin.com Subject: Re: Multiple attempts at opening same pipe for writing fail Message-Id: <20180614004401.2097b4da97c3993cc087430a@nifty.ne.jp> In-Reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00151.txt.bz2 Hi João, On Wed, 6 Jun 2018 18:23:08 +0200 João Eiras wrote: > 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 ! Is this related to https://cygwin.com/ml/cygwin/2017-03/msg00188.html ? -- Takashi Yano -- 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