Yeah there are quite a few bugs related to pre-stop scripts, they don't really work like any other, so there are definite gaps in the coverage
On Thu, Feb 24, 2011 at 8:00 AM, scm <703...@bugs.launchpad.net> wrote: > I can confirm I see this behavior in upstart (0.6.5-8) on lucid. On > several of our custom tasks, if I change pre-stop to post-stop, then > restart behaves normally. I will see if I can craft an upstart job to > mimic this behavior using stock tools. > > -- > You received this bug notification because you are a member of Upstart > Developers, which is subscribed to upstart . > https://bugs.launchpad.net/bugs/703800 > > Title: > restart command fails to restart main process when pre-stop stanza > exists > > Status in Upstart: > New > Status in “upstart” package in Ubuntu: > New > > Bug description: > While testing the portmap daemon's recent changes in Ubuntu which > cause statd to properly follow it on stop/start, I tried to restart > portmap, only to find that it was not in fact restarted. > > This happens with any job that has a pre-stop. The reason is that in > job_restart(), the code does this: > > > job_change_goal (job, JOB_STOP); > job_change_goal (job, JOB_START); > > job_change_goal will return as soon as the *first* state change has > been completed. If there is no pre-stop, that is the change from > JOB_RUNNING to JOB_KILLED, which does dutifully kill the main process. > > However, if there is a pre-stop, the pre-stop is run, but then > job_change_state returns to job_change_goal, which then returns to > job_restart, which then changes the goal back to start, which makes > the new job_next_state() one that will bypass the change to > JOB_KILLED. > > This was found on upstart v0.6.7-3 in Ubuntu, but also exists in the > code in the current trunk. > > TEST CASE > > 1. create job file /etc/init/test-restart-prestop.conf with this content: > # test-restart-prestop > > pre-stop exec /bin/true > > exec /bin/sleep 3600 > 2. run "start test-restart-prestop" -- record pid of job > 3. immediately run "restart test-restart-prestop" -- if bug is present, > pid remains the same when it should be a new pid. > -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/703800 Title: restart command fails to restart main process when pre-stop stanza exists -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs