delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/11/09/19:39:05

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1056A3858436
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1636504744;
bh=k4llnzHOlAmpC4iSzVFMBjpIJxYK7L/YLVYA8N9v34M=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=ToOhymvRBiMMCpHOwReqdbfMgC0ghuQbldzH9XvCzhwp5JpdN5RVYnNzcvqQGr0iP
DGU9gkWi0oocNkio3D14GpwFUbwaG/oeMGV7tEjL/qvVHNI8GYzE3kkF1RIMYxbahV
S4IIbRhcdBITdlBNteWxwlznlEcEnQtJPkd0RBOs=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EC00C3858404
DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com 1AA0bYfb014253
X-Nifty-SrcIP: [110.4.221.123]
Date: Wed, 10 Nov 2021 09:37:41 +0900
To: cygwin AT cygwin DOT com
Subject: Re: Another pipe-related problem?
Message-Id: <20211110093741.d15b99a1361e680f87b61fd8@nifty.ne.jp>
In-Reply-To: <20211110091613.26a636e789fe36a098412f1b@nifty.ne.jp>
References: <f5br1bqaj11 DOT fsf AT ecclerig DOT inf DOT ed DOT ac DOT uk>
<05c4180e-396b-4af3-ac0c-2ab8125df17e AT cornell DOT edu>
<f5bk0hh8uox DOT fsf AT ecclerig DOT inf DOT ed DOT ac DOT uk>
<eb8d7d4f-d1ed-6f30-2ac3-1b24166243d9 AT cornell DOT edu>
<20211110082245 DOT 2943cf3c2519bff24a6843b2 AT nifty DOT ne DOT jp>
<20211110082932 DOT 3e33bae9364db0dda0c57d16 AT nifty DOT ne DOT jp>
<20211110084822 DOT fa32acb567bd26ab43c393bd AT nifty DOT ne DOT jp>
<20211110091613 DOT 26a636e789fe36a098412f1b AT nifty DOT ne DOT jp>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE,
SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://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: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Takashi Yano via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On Wed, 10 Nov 2021 09:16:13 +0900
Takashi Yano wrote:
> On Wed, 10 Nov 2021 08:48:22 +0900
> Takashi Yano wrote:
> > On Wed, 10 Nov 2021 08:29:32 +0900
> > Takashi Yano wrote:
> > > On Wed, 10 Nov 2021 08:22:45 +0900
> > > Takashi Yano wrote:
> > > > On Tue, 9 Nov 2021 09:11:28 -0500
> > > > Ken Brown wrote:
> > > > > I'll have to reproduce the hang myself in order to test this (or maybe you could 
> > > > > test it), but I now have a new guess: If the read call above keeps failing with 
> > > > > EINTR, then we're in an infinite loop.  This could happen because of the 
> > > > > following code in fhandler_pipe::raw_read:
> > > > > 
> > > > >    DWORD waitret = cygwait (read_mtx, timeout);
> > > > >    switch (waitret)
> > > > >      {
> > > > >      case WAIT_OBJECT_0:
> > > > >        break;
> > > > >      case WAIT_TIMEOUT:
> > > > >        set_errno (EAGAIN);
> > > > >        len = (size_t) -1;
> > > > >        return;
> > > > >      default:
> > > > >        set_errno (EINTR);
> > > > >        len = (size_t) -1;
> > > > >        return;
> > > > >      }
> > > > > 
> > > > > Takashi, is EINTR really the appropriate errno in the default case?  Isn't 
> > > > > cygwait supposed to handle signals?
> > > > 
> > > > I assume cygwait() returns WAIT_SIGNALED when signalled
> > > > by SIGINT, SIGTERM, SIGTSTP, etc...  In this case, EINTR
> > > > should return I think.
> > > > 
> > > > Is it wrong?
> > > 
> > > Ah, if SA_RESTART is set, we should continue to read even
> > > if signalled...
[...]
> No, we don't have to do that because cygwait() do the same
> internally. cygwain() returns WAIT_SIGNALED when signalled
> only if SA_RESTART is not set. So, the current code LGTM.

Ah, however, should we handle WAIT_CANCELED here and call
pthread::static_cancel_self() as following?

   DWORD waitret = cygwait (read_mtx, timeout);
   switch (waitret)
     {
     case WAIT_OBJECT_0:
       break;
     case WAIT_TIMEOUT:
       set_errno (EAGAIN);
       len = (size_t) -1;
       return;
     WAIT_SIGNALED:
       set_errno (EINTR);
       len = (size_t) -1;
       return;
     WAIT_CANCELED:
       pthread::static_cancel_self ();
       /* NOTREACHED */
     default:
       /* Should not reach here. */
       __seterrno ();
       len = (slze_t) -1;
       return;
     }


-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

-- 
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