If the post-start job takes longer than the primary job no "started" event is emitted
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
upstart |
New
|
Undecided
|
Unassigned |
Bug Description
If I create a job that looks like this:
script
sleep 5
end script
post-start script
sleep 10
end script
Then what I see is these state transitions:
$ dbus-monitor member=StateChanged
signal sender=
string ":1.307"
signal sender=:1.0 -> dest=(null destination) serial=712 path=/com/
string "starting"
signal sender=:1.0 -> dest=(null destination) serial=713 path=/com/
string "security"
signal sender=:1.0 -> dest=(null destination) serial=714 path=/com/
string "pre-start"
signal sender=:1.0 -> dest=(null destination) serial=715 path=/com/
string "spawned"
signal sender=:1.0 -> dest=(null destination) serial=716 path=/com/
string "post-start"
signal sender=:1.0 -> dest=(null destination) serial=719 path=/com/
string "stopping"
signal sender=:1.0 -> dest=(null destination) serial=720 path=/com/
string "killed"
signal sender=:1.0 -> dest=(null destination) serial=721 path=/com/
string "post-stop"
signal sender=:1.0 -> dest=(null destination) serial=722 path=/com/
string "waiting"
The result of not ever going into the running state is that we don't get the "started" signal emitted onto DBus. It seems to me that it was started, and it ran, so the started signal should be emitted.
Main process has finished, before post-start managed to complete. Arguably, we should only emit "started" if there still was a main process still around. The job is quite artificial as it's not a long running process/daemon. But even with "task" stanza started is not emitted.
<xnox> tedg: what's the real-world usecase ? /wiki.ubuntu. com/Touch/ Testing# Running_ Security_ tests
<tedg> The case I'm seeing it is in the security confinement tests.
<tedg> They test to ensure that the started applications are confined. But they do so rather quicly.
<tedg> xnox, https:/
So i believe we should fix those tests suites to not be racy and actually leave the main process around for long enough to be inspected & validated.