Upstart script "restart" won't restart service

Bug #772327 reported by 周成瑞
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
xinetd (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: xinetd

# stop xinetd
xinetd stop/waiting
# start xinetd
xinetd start/running, process 9378
# restart xinetd
xinetd start/running, process 9378

I must stop(8) then start(8) it to restart.

I investigate the upstart script at /etc/init/xinetd.conf. The pre-stop script is:

pre-stop script
  xinetd_pid=$(status | awk '/stop\/pre-stop/ { print $NF }')
  [ -n "${xinetd_pid}" ] || exit 0
  kill -QUIT "${xinetd_pid}"
end script

The first line gets nothing when invoking restart. I think that's because awk cannot match the pattern when invoing 'restart'. It matches when invoking 'stop'. I think using /var/run/xinetd.pid is safe. Changed it to this:

pre-stop script
  xinetd_pid=$(cat /var/run/xinetd.pid)
  [ -n "${xinetd_pid}" ] || exit 0
  kill -QUIT "${xinetd_pid}"
end script

This will stop the service but won't start it when invoking 'restart'. I do not know the internals of upstart. This may because the pre-stop exit with a non-zero status and 'restart' just killed it and cannot start it?

To fix the problem in the bug summary , I have to comment out the pre-stop script, and 'restart' works OK. I see bug 605007, the author need SIGQUIT, but in my way SIGQUIT is not explicitly sent. I do not know why SIGQUIT is needed.

IMHO, this script needs a fix. But I haven't figured out a good patch. Thank you guys.

Revision history for this message
周成瑞 (e93b5ae3) wrote :

My version is 2.3.14-7ubuntu4 in natty.

Revision history for this message
周成瑞 (e93b5ae3) wrote :

I added this patch. Although It misses SIGQUIT, it solves the restart problem. Must we do it in the original way?

tags: added: patch
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Hi Pan! Thanks for the bug report!

There are known problems w/ upstart when using restart with jobs that have 'pre-stop'. In fact, I believe this bug is just a duplicate of bug #703800, so I'm marking it as such. For now, using stop/start is the best workaround.

tags: removed: patch
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.