[systemd-devel] option to wait for pid file to appear

Michael Chapman mike at very.puzzling.org
Thu Jun 7 08:27:30 UTC 2018


On Thu, 7 Jun 2018, Igor Bukanov wrote:
> On 18 May 2018 at 19:37, Lennart Poettering <lennart at poettering.net> wrote:
> > On Do, 17.05.18 22:54, Igor Bukanov (igor at mir2.org) wrote:
> > Well, no. The protocol is clear, and what we do is pretty close to
> > black magic, and still racy in many ways.
> >
> > I mean, broken behaviour is still broken behaviour, even if we
> > nowadays handle it pretty nicely. Really, nginx should be fixed,
> > everybody benefits, sysvinit as much as we do.
> 
> It turned out it is not only nginx that behaves this way. Any program
> that is using the daemon(3) call available both in Linux and BSD
> writes the pid from the child without the parent waiting. So this
> behaviour must be widespread and as such I think must be accepted as a
> de-facto standard (even if it is unfortunate) and systemd should not
> even warn about it.

I would agree. There's nothing the end user can really do about it, and 
they're more likely to complain here about it than the problematic 
software.

For what it's worth, I took a look at the Type=pid-file idea again... and 
I'm not sure if I'm going to be able to do it. The problem is primarily 
the way systemd only tracks up to one "control" process and one "main" 
process, and that with Type=pid-file it's not clear at the outset whether 
the process spawned by systemd is one or the other. I don't think starting 
it off as a control process and then converting it to a main process -- if 
and only if it writes its own PID out -- is the right approach.

So I might have to leave this idea for now, unless I can think of some way 
around this. Sorry if you were waiting on it.


More information about the systemd-devel mailing list