GNU bug report logs - #67132
[Shepherd] Bogus value from PID file can prevent service from being stopped

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: Ludovic Courtès <ludo@HIDDEN>; Done: Ludovic Courtès <ludo@HIDDEN>; Maintainer for guix is bug-guix@HIDDEN.

Message received at 67132-done <at> debbugs.gnu.org:


Received: (at 67132-done) by debbugs.gnu.org; 22 Nov 2023 10:16:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 22 05:16:51 2023
Received: from localhost ([127.0.0.1]:58038 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r5kHr-00064y-Co
	for submit <at> 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 <ludo@HIDDEN>) id 1r5kHp-00064m-Fj
 for 67132-done <at> 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 <ludo@HIDDEN>) id 1r5kHg-0007KZ-UF
 for 67132-done <at> 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?= <ludo@HIDDEN>
To: 67132-done <at> debbugs.gnu.org
Subject: Re: bug#67132: [Shepherd] Bogus value from PID file can prevent
 service from being stopped
In-Reply-To: <87msvizwzh.fsf@HIDDEN> ("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@HIDDEN>
Date: Wed, 22 Nov 2023 11:16:37 +0100
Message-ID: <87fs0ym6t6.fsf@HIDDEN>
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 <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Ludovic Court=C3=A8s <ludo@HIDDEN> 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.




Notification sent to Ludovic Courtès <ludo@HIDDEN>:
bug acknowledged by developer. Full text available.
Reply sent to Ludovic Courtès <ludo@HIDDEN>:
You have taken responsibility. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Nov 2023 17:46:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 12 12:46:29 2023
Received: from localhost ([127.0.0.1]:56951 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1r2EXV-0004Y1-D9
	for submit <at> 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 <ludo@HIDDEN>) id 1r2EXT-0004Xn-Mr
 for submit <at> 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 <ludo@HIDDEN>) id 1r2EWj-0003zt-39
 for bug-guix@HIDDEN; 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 <ludo@HIDDEN>) id 1r2EWi-0005Pm-RI
 for bug-guix@HIDDEN; 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?= <ludo@HIDDEN>
To: bug-guix@HIDDEN
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@HIDDEN>
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 <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
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.




Acknowledgement sent to Ludovic Courtès <ludo@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#67132; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 22 Nov 2023 10:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.