DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 5278s0EG894739 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 5278s0EG894739 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=PPjmD2eA X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7D605385843D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1741337639; bh=8KtF49phTU0xHzMQ9ecSWKnxevhz+olMrNjKK8LEX28=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=PPjmD2eA9oy1NMWC1B/If2UH3S2DZPnHh2ar0zGO5OCL+Yz25dQw/SHSqBvcKDt6e dS8wTBxfwV7Ax31PVLQ16LoUcYI2OD4uBXwVU6vkcgSudkbsn1Q1BuewMwRoaQffMT RbVNL0wXpo6e0R/oACivaL81ybekxEg1j5O9xexU= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 858223858406 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 858223858406 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1741337609; cv=pass; b=iAxjn1QdpKTelSqFXXhPevzSGTCI+v7C+NR5McSEO+2C+ZcaNPs/kqCdJzkCkNgDqGPNf4qc7FZVYqWzsPj2LDQIVUMv2jb3JTt7grP4En1Ta5FnXgC32vgGZnR4si54IgUzi4U1t+Ky7WwzcfDqN0eM1dbDGlJtA0X7XmArsC8= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1741337609; c=relaxed/simple; bh=gezODU/J6tHCKq+oAE7kYx10C692mhLA7Oma2T7qlvQ=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=nI0VIaWZSBxQVh9yc2iXw1MMfrNGQiTt3rzYIc9rcVHbAidUEzk5DpTCxUWJzDyttd5JMTHnOZ9ZvCBnsAiCIBEtijEydvJec+h3AxIdCG+kGu+jwFVYsBvykjJIWE9pD2gsvA2VxJ/XmtbhaEpujqyx+hbvXtXVV9cGBD8VULI= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 858223858406 X-Sender-Id: dreamhost|x-authsender|gisburn AT nrubsig DOT org ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1741337608; a=rsa-sha256; cv=none; b=NCRF3rAKFGzz3IXkORyxPC1WNR3n82O/FBwMQcXT1Miwz7Bf6CmWB7HxLBlsm/5ICd4xSS tOi7iz3gRVgyyNuAkiXZeUAMS0A6Y+2zOLRBO6Bd67JB/RZEY826+96TwF4HCNZLI+kMGq mDDgwqFj9ShNUSowfCMljJxr6RmDkflK9kdZNsfr5Rh58k8t58YSxEEd28bqhHe4uD4m9u 1yNlYjlBoUaqKFvCp9fMdfmNNwEsW2vDrLDAAPhYj52qTdoEseZEStEIkwxFMunMdB5W9c c/+9VZxm4t0xQNnFE3wUZnCZxTkR1Kg2lIH1NUOeujOLc06XLET4W2yCz5ixpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1741337608; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=POY3WW9j4gouO5pDajaj4Iran5QZ+msO6HcJBaCZ+5c=; b=Te4zb/xyStIxduy4CTtJXQoUFHxd4iaY/ohaBUyOGPBsXnHwVvORUIOR7pUkaqY5aHWvI8 EaQij+8+nNMGtEwZ/5eSd1egkrpbX1AthvYZyRIq5znnjPjx4BOBwBWXJxauMdUB4g95rW q8jvx3HxSBrhpTFR0R44Sed23cp7EITdUMl+AD/4oxQ5CwnOZvShjsSktfcAobOwb8eqKK +U3lM9+Rq5QA40LTUdDuy0kiCm7b6Wdngze9ew7GCYHEectrvBi8Z5tPtpVm0vqWVgIq8L nNZJTUMqCsM7l1R40YD5x5RrMvaXhq191HnsgkyIVm1H4/PsFiUMZc2Q48+ldw== ARC-Authentication-Results: i=1; rspamd-bc7dff857-xwsdk; auth=pass smtp.auth=dreamhost smtp.mailfrom=roland DOT mainz AT nrubsig DOT org X-Sender-Id: dreamhost|x-authsender|gisburn AT nrubsig DOT org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|gisburn AT nrubsig DOT org X-MailChannels-Auth-Id: dreamhost X-Whimsical-Invention: 4d155307710567ed_1741337608343_863816241 X-MC-Loop-Signature: 1741337608343:2186773951 X-MC-Ingress-Time: 1741337608343 X-Gm-Message-State: AOJu0YxebQLU7HcTyFPOF0TQpjW5K0R0U0lShNKttlemVZ2Ia4VpaNOq fHzv13QVDSKw9Mr/4wGfDI7hFd2yDKqDbWaqyJ5TDw5wZt/GHKwLeP8KiQLSTkOlsYCA3EaQ1AK znl2rkylN41pyleUlj7tM4hPP0Jo= X-Google-Smtp-Source: AGHT+IH6DB0YE35j4OR2d1zwBVUuJiNJjpl3vICMxwoOhvlvoxNTMBp6FUeEDuBw+4ad5pqLYAafZKP8rbEzHKdMuwU= X-Received: by 2002:a05:600c:4450:b0:43b:d531:ca9a with SMTP id 5b1f17b1804b1-43c68702906mr17870185e9.31.1741337606708; Fri, 07 Mar 2025 00:53:26 -0800 (PST) MIME-Version: 1.0 References: <8c465025-4858-3113-fe2d-ce00dad21f8a AT t-online DOT de> <20250228212020 DOT 433a339f073060f65a0a736d AT nifty DOT ne DOT jp> <20250307162951 DOT f6d301ec44a0a51fdf32aaf3 AT nifty DOT ne DOT jp> <20250307170157 DOT 862a6639be4e348b5b10fe83 AT nifty DOT ne DOT jp> In-Reply-To: <20250307170157.862a6639be4e348b5b10fe83@nifty.ne.jp> Date: Fri, 7 Mar 2025 09:53:00 +0100 X-Gmail-Original-Message-ID: X-Gm-Features: AQ5f1JqegrH8KfAKiUUK1p5TklnMUkD0-V1D4oYV2MGziKAjYHZjhwQWp2cEhIs Message-ID: Subject: Re: lost signal (was: cygwin 3.6.0: Signals may fail permanently if received after SIGSTOP) To: cygwin AT cygwin DOT com X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , From: Roland Mainz via Cygwin Reply-To: Roland Mainz Content-Type: text/plain; charset="utf-8" Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 5278s0EG894739 On Fri, Mar 7, 2025 at 9:01 AM Takashi Yano via Cygwin 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: > > > Takashi Yano via Cygwin wrote: > > > > On Mon, 24 Feb 2025 11:29:59 +0100 > > > > Christian Franke wrote: > > > >> Found with 'stress-ng --cpu-sched 1': > > > >> > > > >> Testcase (attached): > > > >> > > > >> $ uname -r > > > >> 3.6.0-0.387.g8cebbb2b42bf.x86_64 > > > >> > > > >> $ gcc -o timersig timersig.c > > > >> > > > >> $ ./timersig > > > >> 638: fork()=639 > > > >> !!!!!!!!!!!!!...!!!!!!!!!!!!!SIGSTOP: Permission denied > > > >> 0 [itimer] timersig 639 sig_send: error sending signal 14, pid 639, > > > >> pipe handle 0x14C, nb 0, packsize 192, Win32 error 0 > > > >> SIGKILL: Permission denied > > > >> > > > >> $ kill 639 > > > >> -bash: kill: (639) - Permission denied > > > >> > > > >> $ kill -9 639 > > > >> -bash: kill: (639) - Permission denied > > > >> > > > >> $ /bin/kill --force 639 > > > >> > > > >> $ /bin/kill --force 639 > > > >> kill: 639: No such process > > > >> > > > >> > > > >> A similar problem, but without the "error sending signal" message, > > > >> occurs if the timer is not used but the parent process issues SIGSTOP > > > >> SIGALRM SIGCONT ... sequences. > > > > Thanks for the report, especially for the test case. I was able to > > > > easily reproduce the issue. However, I haven't found the cause until > > > > today. I spent 3 days investigating and discovered three bugs that > > > > prevent the test case from behaving as expected. > > > > > > > > I'll submit the patch seriese shotly. > > > > > > Testcase works as expected with 3.6.0-0.419.g3c1308ed890e.x86_64, thanks! > > > > > > > > > Unfortunately signals may be lost, a new testcase is attached: > > > > > > $ uname -r > > > 3.6.0-0.419.g3c1308ed890e.x86_64 > > > > > > $ gcc -o lostsig lostsig.c > > > > > > $ ./lostsig > > > 1157: fork()=1158 > > > SIGALRM x 10 > > > [ALRM] > > > [ALRM] > > > [ALRM] > > > SIGSTOP > > > [ALRM] > > > SIGTERM > > > SIGCONT > > > waitpid()... > > > [TERM] > > > 1158: 4 SIGALRM received, exit(42) > > > waidpid()=1158, status=0x2a00 > > > > > > $ ./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. > > 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. 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. > So I guess SIGSTOP/SIGCONT are never lost in Linux. Traditionally |SIGSTOP|/|SIGCONT| are a special case and bound to the kernel memory used to maintain the target process. ---- Bye Roland -- __ . . __ (o.\ \/ /.o) roland DOT mainz AT nrubsig DOT org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 3992797 (;O/ \/ \O;) -- 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