Upstart crashes when combining respawn and pre-stop scripts
Upstart 0.5.1 has a somewhat awkward behaviour when combining the respawn stanza with the pre-stop function.
The normal behaviour we see is that when stopping a service first the pre-stop is called and that only after the pre-stop
has finished post-stop is called. However when we add a respawn stanza the post-stop script is called immediately
after the main process died and upstart crashes.
Expected behaviour (test1)
# initctl start test_pre_stop1
# initctl stop test_pre_stop1
Behaviour as seen(test4)
# initctl start test_pre_stop4
# initctl stop test_pre_stop4
initctl: Unable to stop job: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
# Kernel panic - not syncing: Attempted to kill init!
rah state changed from stopping to killed
rah state changed from killed to post-stop
rah post-stop process (32487)
rah pre-stop process (32484) exited normally
zsh: abort (core dumped) ./init
1103IIInih_assert (job->state == JOB_PRE_STOP);
(gdb) p job->state
$1 = JOB_POST_STOP