From unknown Thu Jun 19 14:13:41 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#67132 <67132@debbugs.gnu.org> To: bug#67132 <67132@debbugs.gnu.org> Subject: Status: [Shepherd] Bogus value from PID file can prevent service from being stopped Reply-To: bug#67132 <67132@debbugs.gnu.org> Date: Thu, 19 Jun 2025 21:13:41 +0000 retitle 67132 [Shepherd] Bogus value from PID file can prevent service from= being stopped reassign 67132 guix submitter 67132 Ludovic Court=C3=A8s severity 67132 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 12 12:46:29 2023 Received: (at submit) by debbugs.gnu.org; 12 Nov 2023 17:46:29 +0000 Received: from localhost ([127.0.0.1]:56951 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2EXV-0004Y1-D9 for submit@debbugs.gnu.org; Sun, 12 Nov 2023 12:46:29 -0500 Received: from lists.gnu.org ([2001:470:142::17]:44266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2EXT-0004Xn-Mr for submit@debbugs.gnu.org; Sun, 12 Nov 2023 12:46:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r2EWj-0003zt-39 for bug-guix@gnu.org; Sun, 12 Nov 2023 12:45:41 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r2EWi-0005Pm-RI for bug-guix@gnu.org; Sun, 12 Nov 2023 12:45:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=J45o1acM5jxvId3+VH8VPIXix+qUitqjjTIogJkOGHE=; b=j+zQUzM4v8ahDd YBIgDsoCfrBWjl6nsSMMuCvLE9YidNfXBlOAiOyBdNIAx6Mg1W3I6kIdxxyV4+8Yxhz3e/btC+8Sv DGYxTICorLgL0j0DjP02/Jo7zlqdLRdGCiyw52TS5JjxUS1Rv7Ef7OYXvPZD/s+VBDXYdjmb3J2pK FJ1zeLYssYeAxHEyT2folz9X+eCRyjmOuWpxsJKy/xphXiUxh9kptswgEQOJujweLKGN/9dNn0qdp vt/Lwl4eG1NBb2CfxmNPrRI4JF0BfyfuoMNbbwBEpsjqTcftMYLtHRvbbkGinnHkYei4Yqo2f9f+C 2H8+ZlzycN1VIK99BRNA==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: bug-guix@gnu.org Subject: [Shepherd] Bogus value from PID file can prevent service from being stopped X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Duodi 22 Brumaire an 232 de la =?utf-8?Q?R=C3=A9volu?= =?utf-8?Q?tion=2C?= jour de l'Azerole X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sun, 12 Nov 2023 18:45:38 +0100 Message-ID: <87msvizwzh.fsf@inria.fr> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, =E2=80=98terminate-process=E2=80=99 in (shepherd service) assumes that, onc= e it has sent SIGKILL to a given PID, it eventually gets a SIGCHLD notification for that PID. Unfortunately there are corner cases where it doesn=E2=80=99t hold. Take P= ID 2: --8<---------------cut here---------------start------------->8--- $ ps x 2 PID TTY STAT TIME COMMAND 2 ? S 0:00 [kthreadd] --8<---------------cut here---------------end--------------->8--- That=E2=80=99s not a =E2=80=9Creal=E2=80=9D process, so when you (kill 2 SI= GKILL), nothing happens. Thus, =E2=80=98terminate-process=E2=80=99 never returns; the corr= esponding service stays in =E2=80=9Cstopping=E2=80=9D state and you cannot halt your = machine. You may wonder how we end up calling =E2=80=98terminate-process=E2=80=99 wi= th a =E2=80=9Cbogus=E2=80=9D PID. It normally never happens, but it can happen with a combination of =E2=80=98make-forkexec-constructor=E2=80=99 with #:pid-file and =E2=80=98least-authority-wrapper=E2=80=99: the PID file of the wrapper may = read =E2=80=9C2=E2=80=9D (the PID inside the least-authority PID namespace), so =E2=80=98herd stop=E2=80= =99 on that service will end up doing (kill 2 SIGKILL). Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 22 05:16:51 2023 Received: (at 67132-done) by debbugs.gnu.org; 22 Nov 2023 10:16:51 +0000 Received: from localhost ([127.0.0.1]:58038 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r5kHr-00064y-Co for submit@debbugs.gnu.org; Wed, 22 Nov 2023 05:16:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r5kHp-00064m-Fj for 67132-done@debbugs.gnu.org; Wed, 22 Nov 2023 05:16:50 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5kHg-0007KZ-UF for 67132-done@debbugs.gnu.org; Wed, 22 Nov 2023 05:16:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=XAQXKfBVykFfAgJC+m4jBseBQIUt4B24cTVF9DtZQS4=; b=U9mW3VhSk40ZfXbWij0d apCDYMuyacFhuVafCkJ+3TQTBailLY8Mr5s/emXHBJbnbHN00G5nnQucKVE3PibgAknMQQ1MWW5dY QqyDrjlCQWfvvd8DbNqwDR5rseWAITOf8kGIFm6GW/4mMxWDgAeRwoNFAOK6qU7cWHfo945LCUBf3 yygzVOWgm1XMe6q2aboeCgjryzEBOvi3pS+oBW16l2G9ZxFAxYAm0y4wmA3ISoWfhYlJOYVFBv/DF xAbg7/VNfKRM/+gJmKOMIdOSTKuJv4z0/0lJ15MUu+NbeqWJAxF9nCXLIWAbwHpYvsuq9u6EbN8/7 ZQ666LLU66aY/A==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: 67132-done@debbugs.gnu.org Subject: Re: bug#67132: [Shepherd] Bogus value from PID file can prevent service from being stopped In-Reply-To: <87msvizwzh.fsf@inria.fr> ("Ludovic =?utf-8?Q?Court=C3=A8s=22?= =?utf-8?Q?'s?= message of "Sun, 12 Nov 2023 18:45:38 +0100") References: <87msvizwzh.fsf@inria.fr> Date: Wed, 22 Nov 2023 11:16:37 +0100 Message-ID: <87fs0ym6t6.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67132-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ludovic Court=C3=A8s skribis: > =E2=80=98terminate-process=E2=80=99 in (shepherd service) assumes that, o= nce it has sent > SIGKILL to a given PID, it eventually gets a SIGCHLD notification for > that PID. > > Unfortunately there are corner cases where it doesn=E2=80=99t hold. Take= PID 2: > > $ ps x 2 > PID TTY STAT TIME COMMAND > 2 ? S 0:00 [kthreadd] > > That=E2=80=99s not a =E2=80=9Creal=E2=80=9D process, so when you (kill 2 = SIGKILL), nothing > happens. Thus, =E2=80=98terminate-process=E2=80=99 never returns; the co= rresponding > service stays in =E2=80=9Cstopping=E2=80=9D state and you cannot halt you= r machine. Fixed in Shepherd commit cc9c5c029534458ae547d78200b6b51f729654e3. Ludo=E2=80=99. From unknown Thu Jun 19 14:13:41 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 20 Dec 2023 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator