From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47932) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVzZn-0000gm-2U for guix-patches@gnu.org; Fri, 14 Jul 2017 08:20:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVzZi-0006F0-Ui for guix-patches@gnu.org; Fri, 14 Jul 2017 08:20:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:35161) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVzZi-0006Eo-RA for guix-patches@gnu.org; Fri, 14 Jul 2017 08:20:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dVzZi-00073z-Ia for guix-patches@gnu.org; Fri, 14 Jul 2017 08:20:02 -0400 Subject: [bug#27553] [PATCH shepherd] Register SIGCHLD handler after primitive fork Resent-Message-ID: MIME-Version: 1.0 In-Reply-To: <87a849bar1.fsf@gnu.org> References: <87a849bar1.fsf@gnu.org> From: Jelle Licht Date: Fri, 14 Jul 2017 14:19:12 +0200 Message-ID: Content-Type: multipart/alternative; boundary="94eb2c1f9ec0a2bc360554460e0e" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 27553@debbugs.gnu.org --94eb2c1f9ec0a2bc360554460e0e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Ludo, 2017-07-12 23:34 GMT+02:00 Ludovic Court=C3=A8s : > Hi Jelle, > > Jelle Licht skribis: > > > I am not sure if this is also the proper ML for the GNU Shepherd, but > > looking in the archives lead me to believe it actually is. If not, I > > suggest the gnu.org page for shepherd be updated with the correct info. > > It=E2=80=99s the right list. :-) > I am glad it turned out to be :-). Perhaps [1] can be updated to the same info as [2]? > > > I recently starting playing around with user shepherd, and found out th= at > > when running a shepherd 0.3.2 daemonized as non-init process (via > "(action > > 'shepherd 'daemonize)"), zombie processes are created whenever you star= t > > and subsequently stop any service. > > > > Thinking I did something wrong, I asked lfam on #guix to share his (ver= y > > helpful) init.scm for user shepherd, yet I still noticed the same > behaviour. > > > > I believe commit `efa2f45c5f7dc735407381b7b8a83d6c37f828db' > inadvertently > > introduced an ordering issue, where the SIGCHLD handler is registered > > /before/ shepherd has the chance to daemonize. I believe the following > > trivial patch addresses this snafu. > > The config file can start services, so the SIGCHLD handler must be > installed before we read the config file (otherwise we could be missing > some process termination notifications.) > What do you mean exactly? I think my config file does this, and I have not yet noticed this issue, but I might just be confused about what you mean here. > > Perhaps a solution would be to install the SIGCHLD handler lazily upon > the first =E2=80=98fork+exec-command=E2=80=99 call? That would ensure bo= th that (1) > users have a chance to daemonize before the handler is installed, and > (2) that the handler is installed before services are started. > > Thoughts? > This seems like it would be for the best. I actually have no clue how to implement this though. Regards, Jelle [1]: https://www.gnu.org/software/shepherd/ [2]: https://www.gnu.org/software/guix/about/#contact --94eb2c1f9ec0a2bc360554460e0e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Ludo,

2017-07-12 23:34 GMT+02:00 Ludovic Court=C3=A8s <ludo@gnu.org= >:
Hi Je= lle,

Jelle Licht <jlicht= @fsfe.org> skribis:

> I am not sure if this is also the proper ML for the GNU Shepherd, but<= br> > looking in the archives lead me to believe it actually is. If not, I > suggest the gnu.org page for shepherd be updated with the correct info.

It=E2=80=99s the right list.=C2=A0 :-)
I am gla= d it turned out to be :-). Perhaps [1] can be updated to the same info as [= 2]?
=C2=A0

> I recently starting playing around with user shepherd, and found out t= hat
> when running a shepherd 0.3.2 daemonized as non-init process (via &quo= t;(action
> 'shepherd 'daemonize)"), zombie processes are created whe= never you start
> and subsequently stop any service.
>
> Thinking I did something wrong, I asked lfam on #guix to share his (ve= ry
> helpful) init.scm for user shepherd, yet I still noticed the same beha= viour.
>
> I believe commit `efa2f45c5f7dc735407381b7b8a83d6c37f828db' i= nadvertently
> introduced an ordering issue, where the SIGCHLD handler is registered<= br> > /before/ shepherd has the chance to daemonize. I believe the following=
> trivial patch addresses this snafu.

The config file can start services, so the SIGCHLD handler must be installed before we read the config file (otherwise we could be missing
some process termination notifications.)
What do you = mean exactly? I think my config file does this, and I have not yet noticed = this issue,
but I might just be confused about what you mean = here.
=C2=A0

Perhaps a solution would be to install the SIGCHLD handler lazily upon
the first =E2=80=98fork+exec-command=E2=80=99 call?=C2=A0 That would ensure= both that (1)
users have a chance to daemonize before the handler is installed, and
(2) that the handler is installed before services are started.

Thoughts?
This seems like it would be for the best. I = actually have no clue how to implement this though.
=C2=A0
Regards,
--94eb2c1f9ec0a2bc360554460e0e--