delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/11/09/21:03:55

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E45D63857C4F
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1636509833;
bh=FKFe/76M95dKmu8jw9iGwKc8de24IY/hFSr2lpUhmOE=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=eSVUk0JldiaRViLGarkCQ1o94pjguR03UHW4vlJy/1KZDDCpkraSvzM9Wwi4xSB4s
9xZ9K8AtElWZDyhIB2W2F4Pdj2VzA4UMzFOxeYptEMEnzVJethJTWoigjssJgqkNJB
Nd9MY0JHdNCI1Gkfl6vELLRrFGmGajeWRqFdPYq0=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AED4A385842B
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=FzOYFEcymFYc/aQyMUn9z4vyTyPVAyiFXHTu4nil6EJxJ5trEd1/9qcLf/KZsln3TdKUrGXrVz3DmAiDv97c9CdM0+njmCXEvHTiYoZ39qhmvx6XVirv9Je4QrzVWf/ih5OV8AFspfbCY3kAmBwNUBrgO1+fvskt/1yeOmZb9o0NzhdLnQt0ACoMSJfi1SHTNcCTcIkLcN/3PD61yvZxuABYrsCZsUOP/oQbd15KBznDaTH6dK2/pJgTTdf8TqCMcPegjRXcxi16OeLmqNskfEYLxLbe1cIwcugXRI3JAS4JF/Nwiu9o6egflIFCcm05lXydLG2mHONFB7UebyqsgA==
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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=kMyuW5ya6ZJzpoKY1ukTafsbJZ7N4UZMVAfu98OlibU=;
b=ddRE7uyVHvH2jUAAM4szQl4JbPOMFm3DSu6GRMmTy4WYyXL2e4rqgMbxcb+6pRe9/q8XjJjqKUsCREBgMXgoTYdHARJmURv/XD3hTCoEVy/ibJBGyOfeVVYs7WzjSEQyG9xklH7fDYktL+3agVmKxjS0kHIs+amiYE19YUBMsisNoinEOl6ysKLwt78l0JLOpLrU1Y7SHbpjQDQ00uEGMDUyXzX5QtzntocTaorQb8wvaz5GB/QCfMXNoYXdedxEk2UAbHTysmOq2BFPAEAw1aAI9vL6jxyU2CWa4U6eeQHeHmLzNpraOzUc4ZitokwKSGv+wV3n0h5XTuXqUr+Kpg==
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
Message-ID: <4b4aa8df-12bc-77d4-7a30-2aaa885dbc4b@cornell.edu>
Date: Tue, 9 Nov 2021 21:02:35 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.0
Subject: Re: Another pipe-related problem?
To: cygwin AT cygwin DOT com
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>
<20211110093741 DOT d15b99a1361e680f87b61fd8 AT nifty DOT ne DOT jp>
In-Reply-To: <20211110093741.d15b99a1361e680f87b61fd8@nifty.ne.jp>
X-ClientProxiedBy: BL1PR13CA0401.namprd13.prod.outlook.com
(2603:10b6:208:2c2::16) To BN7PR04MB4388.namprd04.prod.outlook.com
(2603:10b6:406:f8::19)
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: f4a2a1d5-2495-4933-263a-08d9a3ee2b12
X-MS-TrafficTypeDiagnostic: BN3PR04MB2180:
X-Microsoft-Antispam-PRVS: <BN3PR04MB21807CAE22CF45BE75A3F4F4D8939 AT BN3PR04MB2180 DOT namprd04 DOT prod DOT outlook DOT com>
X-MS-Oob-TLC-OOBClassifiers: OLM:9508;
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: qB3eDTfIe9ABNF1N3ofEq6pONZTd18CPauxfFiiRjkgTnS3RyyH4yjudM77JBvJf82Y5Quus+1Y/lvyTmBWgVBuagl6zvw7WWM1vykiyhf5DACdMDLUGwviiqzjdDPeWfJfihIrnfM2emfH+9LgrmV34kbkGqBT2kUESvWS0EDtTYL1+q1EomUL69PCpTM3yVqthJfmHVIxfyDn0xm6B2iDm6EhaGRcNgsRFqSa5zro5aVAwSDi8MG7A9iveSNkgw7ueGrzCbVYkRyE//YDR1qqmxG/PhrxGoCjxUQh67KDtU2cv27M+UTXfLrr8aWL7EEe1xmm+swOF2FV6iFNA6VFOBaZZBoVA4kr7FpHbWsnP+k7UxyGnR4P5jLVBQZI7/nyji41+m/pf0/ax3HQoxa8xd6mnpHtLVj+SMvHy831OCfZCe/Ak9KYoVcfL+iETLTlXBcqK1dr958MTp2MTYRGSH1pgfaJc1B2Y+AGaMysV/pze7ILOzBB9/+WIPT8i8MBymKGcPDxyT9ThXLUxZ3FwPN61m5/XyyQh/m+D7cLbLO9/l4B5sCvWfSJxD4lYRPDfN6VTBBt/qxBOUjaoU+hS/IuLgDUuE+N77l9AG3gQ6hJy5WsBHf7iPnxAqO+1/JfRAimkUNwKZkOJWGb1RdGnfRoP5uv8qaTNkRF1sbs9UvJamloZjtp22RwLoNGDXoNJnOPNiEsYu0jNMvKq6ZRQioGmSXJlxTUf1MqHmsM=
X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
IPV:NLI; SFV:NSPM; H:BN7PR04MB4388.namprd04.prod.outlook.com; PTR:; CAT:NONE;
SFS:(4636009)(366004)(508600001)(8676002)(83380400001)(66476007)(2616005)(31686004)(66556008)(2906002)(316002)(75432002)(31696002)(5660300002)(786003)(66946007)(3480700007)(186003)(6486002)(86362001)(38100700002)(53546011)(6916009)(36756003)(8936002)(45980500001)(43740500002);
DIR:OUT; SFP:1102;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aXZ3bUJ2UG9LTWI3a3ZDR2lqejBQWll1V1dGa1RlRkJXYTZXSUN3K1hacHJB?=
=?utf-8?B?TUhCUWMyVWZBN1Focmlwa2tOV0k0V2xUT1VWWUE2R1hnYmJzMm81V3U3RHpM?=
=?utf-8?B?Z2t0ZTdkMXBxQzdQWTVBYzdGdnhCMWRLV0lHK1dhNU9ndldiQzg4ZG9aeWph?=
=?utf-8?B?ekJib29WT2tEL2x1WjNIbVdEOUtsRUFKc051V0dQTldsa3pEZGx5dHkyQXE4?=
=?utf-8?B?MC9DSnYreVV6QThKWXhMTzBCVmUwanVqMTVMRmpEWmtxN0ZkT1FNNlp4KzZm?=
=?utf-8?B?Yzc2ZHNxb21scitORXhrZ1p5RGlOVFllMGF2TUE4K0JsMjVLTHRqYlpxUXZu?=
=?utf-8?B?cCtnalp1ZkhJSVJlTFNHOVE3cWNYL09tbDg2T2psV3ZsVE04dmV5ZC96MFdG?=
=?utf-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=?utf-8?B?UEpKRnNJbWYyaTIvNkpBUGlxMlppRDRKci9hSk9vUU5lV0g5Rm9JNndkMjdY?=
=?utf-8?Q?JuVsLha/Yg3YudRK3KKbpGD5AI1Yt3M8w3DnB/qmQ8=3D?=
X-OriginatorOrg: cornell.edu
X-MS-Exchange-CrossTenant-Network-Message-Id: f4a2a1d5-2495-4933-263a-08d9a3ee2b12
X-MS-Exchange-CrossTenant-AuthSource: BN7PR04MB4388.namprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 02:02:37.0898 (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: xAN6QA0bj9EYHwMXDS4bS0ZSmdoffVYum62+txmLe8gMGi+afUNH0vPAtZMy5m3rY6ev29cCcRhs9eSQX2iPXA==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR04MB2180
X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, MSGID_FROM_MTA_HEADER, NICE_REPLY_A,
RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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-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: Ken Brown via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Ken Brown <kbrown AT cornell DOT edu>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On 11/9/2021 7:37 PM, Takashi Yano via Cygwin wrote:
> 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;
>       }

This looks better to me.  I think the default case actually could be reached if 
WFMO returns WAIT_FAILED (admittedly unlikely).

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