[Bug 530779] Re: init: does not wait for parent to exit when following forks

Steve Langasek steve.langasek at canonical.com
Wed Feb 29 00:28:32 UTC 2012


> Waiting until the parent dies will not work in cases such as squid, where the parent
> never dies.

This didn't make sense to me, so I had a look.  The current squid
package in Ubuntu runs with -N, which is "no daemonize" (i.e.,
foreground) mode.  So in that case, certainly, the parent doesn't die...
because the parent doesn't fork.  And the upstart job uses neither
'expect fork' nor 'expect daemon'.  However, if run without -N, squid
certainly does fork and exit as expected.

We still certainly need to think carefully about changing upstart to
track exits instead of just forks; but for my part I can't see any way
that this behavior change would break existing jobs.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to upstart in Ubuntu.
https://bugs.launchpad.net/bugs/530779

Title:
  init: does not wait for parent to exit when following forks

Status in Upstart:
  Triaged
Status in “upstart” package in Ubuntu:
  Triaged
Status in “upstart” source package in Precise:
  Triaged

Bug description:
  When following a fork, once Upstart receives the new pid, it
  immediately starts following that and forgets about the parent
  entirely not even waiting for it to exit.

  There are two problems with this:

  The first is the kind of daemon that forks early, but then maintains
  communication with the parent so that the parent can exit with an
  appropriate exit code in case of error (rather than the kind which
  only fork once they are ready).  These kinds aren't ready until the
  parent exits, not at the point of the fork.  Since upstart follows the
  fork, it will think they are ready "too early"

  The second is simply any that writes a pid file (which is perhaps a
  simplification of the above), if they write the pid file in the parent
  (as even nih_main_daemonise does!) then there's no guarantee the pid
  file actually exists when the "start" command returns.

  (Other than the fact we use ptrace tends to mean that the race works
  out in our favour)

To manage notifications about this bug go to:
https://bugs.launchpad.net/upstart/+bug/530779/+subscriptions




More information about the foundations-bugs mailing list