emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67132: closed ([Shepherd] Bogus value from PID file can prevent serv


From: GNU bug Tracking System
Subject: bug#67132: closed ([Shepherd] Bogus value from PID file can prevent service from being stopped)
Date: Wed, 22 Nov 2023 10:17:01 +0000

Your message dated Wed, 22 Nov 2023 11:16:37 +0100
with message-id <87fs0ym6t6.fsf@gnu.org>
and subject line Re: bug#67132: [Shepherd] Bogus value from PID file can 
prevent service from being stopped
has caused the debbugs.gnu.org bug report #67132,
regarding [Shepherd] Bogus value from PID file can prevent service from being 
stopped
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
67132: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=67132
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [Shepherd] Bogus value from PID file can prevent service from being stopped Date: Sun, 12 Nov 2023 18:45:38 +0100 User-agent: Gnus/5.13 (Gnus v5.13)
Hi,

‘terminate-process’ in (shepherd service) assumes that, once 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’t hold.  Take PID 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’s not a “real” process, so when you (kill 2 SIGKILL), nothing
happens.  Thus, ‘terminate-process’ never returns; the corresponding
service stays in “stopping” state and you cannot halt your machine.

You may wonder how we end up calling ‘terminate-process’ with a “bogus”
PID.  It normally never happens, but it can happen with a combination of
‘make-forkexec-constructor’ with #:pid-file and
‘least-authority-wrapper’: the PID file of the wrapper may read “2” (the
PID inside the least-authority PID namespace), so ‘herd stop’ on that
service will end up doing (kill 2 SIGKILL).

Ludo’.



--- End Message ---
--- Begin Message --- Subject: Re: bug#67132: [Shepherd] Bogus value from PID file can prevent service from being stopped Date: Wed, 22 Nov 2023 11:16:37 +0100 User-agent: Gnus/5.13 (Gnus v5.13)
Ludovic Courtès <ludo@gnu.org> skribis:

> ‘terminate-process’ in (shepherd service) assumes that, once 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’t hold.  Take PID 2:
>
> $ ps x 2
>   PID TTY      STAT   TIME COMMAND
>     2 ?        S      0:00 [kthreadd]
>
> That’s not a “real” process, so when you (kill 2 SIGKILL), nothing
> happens.  Thus, ‘terminate-process’ never returns; the corresponding
> service stays in “stopping” state and you cannot halt your machine.

Fixed in Shepherd commit cc9c5c029534458ae547d78200b6b51f729654e3.

Ludo’.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]