init: does not wait for parent to exit when following forks
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
upstart |
In Progress
|
Medium
|
James Hunt | ||
upstart (Ubuntu) |
Won't Fix
|
Medium
|
Steve Langasek | ||
Precise |
Won't Fix
|
Medium
|
Steve Langasek |
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)
Related branches
- Steve Langasek: Needs Fixing
-
Diff: 24650 lines (+24167/-52)13 files modifiedChangeLog (+57/-0)
init/Makefile.am (+2/-1)
init/job.c (+17/-18)
init/job_process.c (+41/-6)
init/process.c (+27/-6)
init/process.h (+6/-0)
init/tests/data/upstart-1.12.json (+21708/-0)
init/tests/test_job_process.c (+483/-10)
init/tests/test_state.c (+190/-10)
test/Makefile.am (+8/-1)
test/test_daemon.c (+1485/-0)
test/test_util_common.c (+116/-0)
test/test_util_common.h (+27/-0)
Changed in upstart: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in upstart (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → Medium |
assignee: | nobody → James Hunt (jamesodhunt) |
Changed in upstart (Ubuntu Precise): | |
assignee: | James Hunt (jamesodhunt) → Steve Langasek (vorlon) |
Changed in upstart (Ubuntu): | |
assignee: | James Hunt (jamesodhunt) → Steve Langasek (vorlon) |
Changed in upstart: | |
assignee: | nobody → James Hunt (jamesodhunt) |
Changed in upstart: | |
status: | Triaged → In Progress |
Jun 17 12:50:26 afrodeity-desktop init: plymouth-stop pre-start process (1948) terminated with status 1