Re: Warning "Supervising process..." due to SIGCHLD from grand-parent

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

 



I had my focus on the child (main daemon process), therefore the term went backward parent and grand-parent. Sorry, if that caused confusion, but let's go with your definitions.


Thank you for the explanation and pointing out the steps! Especially 1. makes it much clearer than the list described here https://www.freedesktop.org/software/systemd/man/daemon.html, which only mention that P' shall call exit(). chrony is probably not making sure of 1., were P should wait until P' has exited. Now that you mentioned sysv semantics is old I come across an option in chrony which will not fork. I shall probably try using that instead.


Best Regards,

Christopher Wong


From: Lennart Poettering <lennart@xxxxxxxxxxxxxx>
Sent: Monday, October 31, 2022 11:43:17 AM
To: Christopher Wong
Cc: systemd-devel@xxxxxxxxxxxxxxxxxxxxx
Subject: Re: Warning "Supervising process..." due to SIGCHLD from grand-parent
 
On Mo, 31.10.22 11:40, Lennart Poettering (lennart@xxxxxxxxxxxxxx) wrote:

> This is almost certainly a bug in chrony. If you use Type=forking,
> then the process that systemd forks off (let's call it "P") should
> wait until all of the below holds:
>
> 1. The middle child P' has exited
> 2. The grandchild (and main daemon process) P'' is running
> 3. The PID file has been successfully written to contain the PID of P''.

BTW, let me add an explanation, *why* this is needed: if they leave
P'' running for a bit longer, then there's a race: if for some reason
the deamon ends up failing shortly after starting up there is a race
if P' or P'' die first. If P'' dies first, then the service manager
will never see its SIGCHLD and cannot determine there was a
failure. If P' dies first then all is good, as the P'' SIGCHLD will be
properly collected by the service manager.

But anyway, it's 2022, chrony being stuck in sysv semantics is
sad. Use sd_notify().

Lennart

--
Lennart Poettering, Berlin

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux