X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=V+UjivpBo1cng9kKLx+PXCqGDdtd4wtPu6cZomn6NRv 9sWvJfN/WEI/RacA3dU2HlIx8FLeYkT/Lp76ddQPZIktqpZhNtSJ8p7ald5UGztb s2+Il2owfRmhpsm14j1Fx4nQL8kTIypTMDZLjOTq4IV5/iW81jNurGmlJvedxqDM = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=/LDnvaXvZlZmpmOBXFphBv4/WCg=; b=fBmwQcVb7ypeT0d/n SjYCE3PDRqce/L4/4lkAEtbFM5RmBl3a5Repo08odtI13qFRKLREMUOU722nFpB2 PAA0fmIpNGWNOBk7aZP12tbq3O+GJ31y/CvnHCtsXgFz+h9HXwkNcFOt0zEGH6ut 0g47fVqZUpaPd+rwdlprx/qvek= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com w5DFhuTC008299 X-Nifty-SrcIP: [125.3.30.127] Date: Thu, 14 Jun 2018 00:44:01 +0900 From: Takashi Yano To: cygwin AT cygwin DOT 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 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