delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/03/07/09:58:51

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 527Ewo3t985928
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 527Ewo3t985928
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=T3t5fkmI
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F12E3858D20
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1741351649;
bh=m9tc5CSZEFMa63ymT05AfK8kfDBT//YV5BjipseRkpw=;
h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=T3t5fkmIia84NY6fXwK08qlSsN9Oniu9zjg/NS1ZqJQrCjD3DRg6vt6GFnSKiblmx
AYoKddmqCfLEt3Gletvcw4rHJUQf22cX0X/aQQejFSKUcLCpf6U/YaasvxLMYorLip
4aIKMrjY9jXC6vD+p1S19rv2a1KAeiETdqFooLEc=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 205793858403
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 205793858403
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1741351537; cv=none;
b=REMFmJG+2M/F2yI+9pBoBcAV6nD1Gt7Pxo9RU+YtSgsAShlyISwwp8a8+ToZQq8rUiS9PeYtQJcLV2yQBuBPjo6LQZYOBpbPsvkvCSz3cChNmEcnF5nclbYUkKRCZ9KkD+XdpdQQJZmJDeF4hzof4+0cFFpVkEBQ07ffXInzZVo=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1741351537; c=relaxed/simple;
bh=Q5p8tiG9Qe4/QQJHePIsSrgqrRdaegR74FNl5JKHuVc=;
h=Subject:To:From:Message-ID:Date:MIME-Version;
b=exGuob/gyh8TGMXNs++8wxVLcEFSCGKbYwMv+WLqBFPZN3AKdxjt1qXpvIr2KMRxgC1BPnxnh9UrO/XXg7y1t4whRonrhkjEHjXyA47A1yB3qRB2DhqjLIHMAGQ7oHC2LPir6Nj+dDgKg/H/dEJCAEQoOU7pqO1xs7FQcyMqrjY=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 205793858403
Subject: Re: lost signal
To: cygwin AT cygwin DOT com, cygwin AT cygwin DOT com
References: <8c465025-4858-3113-fe2d-ce00dad21f8a AT t-online DOT de>
<20250228212020 DOT 433a339f073060f65a0a736d AT nifty DOT ne DOT jp>
<de045db2-09b1-b2ab-d0d6-32f8c6906386 AT t-online DOT de>
<20250307162951 DOT f6d301ec44a0a51fdf32aaf3 AT nifty DOT ne DOT jp>
<20250307170157 DOT 862a6639be4e348b5b10fe83 AT nifty DOT ne DOT jp>
<CAKAoaQkO48tqBi61mEGS5hNTrKXag_OO49Hx9BLNwEfkW2wGTA AT mail DOT gmail DOT com>
Message-ID: <7e53e61f-0541-321d-d4fe-e15fe6299998@t-online.de>
Date: Fri, 7 Mar 2025 13:45:33 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101
SeaMonkey/2.53.20
MIME-Version: 1.0
In-Reply-To: <CAKAoaQkO48tqBi61mEGS5hNTrKXag_OO49Hx9BLNwEfkW2wGTA@mail.gmail.com>
X-TOI-EXPURGATEID: 150726::1741351532-A57F999A-B9061379/0/0 CLEAN NORMAL
X-TOI-MSGID: ced43e85-44e6-4f8d-9bb1-3aca328a8c06
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
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: Christian Franke via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Christian Franke <Christian DOT Franke AT t-online DOT de>
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>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 527Ewo3t985928

Roland Mainz via Cygwin wrote:
> On Fri, Mar 7, 2025 at 9:01 AM Takashi Yano via Cygwin
> <cygwin AT cygwin DOT com> wrote:
>> On Fri, 7 Mar 2025 16:29:51 +0900
>> Takashi Yano wrote:
>>> On Wed, 5 Mar 2025 11:23:26 +0100
>>> Christian Franke wrote:
>>>> ...
>>>> Unfortunately signals may be lost, a new testcase is attached:
>>>>
>>>> ...
>>>>
>>>> $ ./lostsig
>>>> 1163: fork()=1164
>>>> SIGALRM x 10
>>>> SIGSTOP
>>>> SIGTERM
>>>> SIGCONT
>>>> waitpid()...
>>>> [ALRM]
>>>> [TERM]
>>>> ...hangs...
>>>>
>>>>
>>>> A 'ps' is a second terminal then shows that the child process is still
>>>> in S)topped state. 'kill -CONT ...' works to continue.
>>>>
>>>> If the testcase is assigned to a single core with 'taskset 0x1 ...', it
>>>> apparently always hangs.
>>> Thanks for the report and the testcase.
>>> The current implementation of the signal queue has the following problems:
>>> 1) Signals in the queue are processed in a disordered manner.
>>> 2) If the same signal is already in the queue, new signal is discarded.
>>>
>>> I am working on this issue and almost finished.
>>>
>>> Now I'm testing. Please wait a while.

Thanks for working on this complex topic!


>> BTW, the resut of your testcase in Linux is as follows:
>>
>> 231873: fork()=231874
>> SIGALRM x 10
>> [ALRM]
>> [ALRM]
>> [ALRM]
>> SIGSTOP
>> SIGTERM
>> SIGCONT
>> waitpid()...
>> [TERM]
>> 231874: 3 SIGALRM received, exit(42)
>> waidpid()=231874, status=0x2a00
>>
>> Signal-lost also happens. However, it does not hang in Linux.

Sorry, I didn't clarify that the lost SIGALRMs are not the problem. 
These are issued solely to trigger the lost SIGCONT problem.

A test on Linux also shows that signal handlers may be called out of order:

1070: fork()=1071
SIGALRM x 10
SIGSTOP
SIGTERM
SIGCONT
waitpid()...
[TERM]
[ALRM]
[ALRM]
1071: 2 SIGALRM received, exit(42)
waidpid()=1071, status=0x2a00

Same if sigqueue() is used instead of kill().

> BTW: If you do testing PLEASE use |sigqueue()| for |SIGRT*| signals
> (and check the return code!) and NOOT |kill()|, because |kill()|
> cannot communicate if there was no room left to queue another signal.

Thanks for clarification. If the testcase is modified to use sigqueue() 
instead of kill() and SIGRTMIN+0/1 instead of SIGALRM/TERM, sigqueue() 
also always succeeds. On Linux, no signal is lost then, but the disorder 
may still occur.

-- 
Regards,
Christian


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