upstart assumes we can stop tracing processes when exec() is called, breaks 'expect daemon' for cups
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
upstart |
New
|
Undecided
|
Unassigned | ||
upstart (Ubuntu) |
New
|
Medium
|
James Hunt |
Bug Description
trying to improve the cups upstart job in Ubuntu to use 'expect daemon' so that the service is reliably up before upstart proceeds on to running the post-start script, I find that this doesn't work because cups re-execs itself with different commandline options before daemonizing. upstart init/job_process.c has the following:
/*
[...]
* We assume that if the job calls exec that it's finished forking so we can
* drop the trace entirely; we have no interest in tracing the new child.
**/
static void
job_process_
Well, cups obviously violates this expectation, because it unavoidably re-execs itself.
Is the upstart assumption wrong? Is this sanely *fixable* without causing knock-on effects?
ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: upstart 1.3-0ubuntu9
ProcVersionSign
Uname: Linux 3.0.0-11-generic x86_64
ApportVersion: 1.23-0ubuntu1
Architecture: amd64
Date: Tue Sep 20 11:03:08 2011
InstallationMedia: Ubuntu 10.04.1 LTS "Lucid Lynx" - Release amd64 (20100816.1)
ProcEnviron:
PATH=(custom, user)
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: upstart
UpgradeStatus: Upgraded to oneiric on 2011-06-27 (85 days ago)
Related branches
- James Hunt: Pending requested
-
Diff: 71 lines (+12/-20)3 files modifiedChangeLog (+6/-0)
init/job_process.c (+4/-18)
init/tests/test_job_process.c (+2/-2)
I dug into this further and discovered to my surprise that cupsd doesn't support daemonizing at all, it only supports backgrounding. And of course it forks before it calls listen() on its sockets. So frankly, I'm not sure how I thought "expect daemon" was going to help here.
Now, even if we patched cupsd to daemonize, or fixed bug #530779, upstart's handling of the reexec would *still* be a problem. So I still think this is a bug in its own right that we should fix.