Re: sdnotify-wrapper docs clarification

From: Brett Neumeier <bneumeier_at_gmail.com>
Date: Fri, 1 Feb 2019 08:49:47 -0600

On Fri, Feb 1, 2019 at 8:30 AM Profpatsch <mail_at_profpatsch.de> wrote:

> > -f: do not doublefork. Use if the daemon waits for children it does
> > not know it has (for instance, superservers do this). When in doubt,
> > do not use that option, or you may have a zombie hanging around.
> Is the “that” here referring to the `-f` option or the daemon?
> In the first case, “do not use >this< option” is less ambiguous.
>
Hello Profpatsch!

Double-forking is a common idiom for daemon processes, as described for
example here:

https://stackoverflow.com/questions/881388

The main purpose of double-forking is to ensure that the long-running
daemon process is re-parented onto whatever `init` process is running as
PID 1. The process running as PID 1 has the responsibility of calling wait
on all of its child processes, even the ones that it did not fork directly,
so that their slot in the process table can be cleaned up; many programs
only call wait on the child processes that they know about.

So what this text is saying is, if you happen to know that the process that
is launching the daemon *does* call wait for child processes it does not
know about, then you can skip the double-fork operation. But if you are not
sure that it does that, you should omit the `-f` option and retain the
default double-fork behavior.

I agree that "...this option" is less ambiguous than "...that option".

-- 
Brett Neumeier (bneumeier_at_gmail.com)
Received on Fri Feb 01 2019 - 14:49:47 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC