[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Really, ...

On Sat, Dec 01, 2012 at 10:39:35PM +0800, Thomas Goirand wrote:

> More over, most of the sleep calls you will find in init scripts (and I
> believe that is what your grep shows, because that's the case on my own
> laptop...) are because of:

> case "${1}" in
> restart|reload|force-reload)
>         ${0} stop
>         sleep 1
>         ${0} start
> ;;

> which I don't think is (so much of) a problem in itself. Unless you
> also consider the above as a race condition (which, really, could
> be a real one...).

Those are also race conditions, and bugs.  If the stop and start commands
return control before the action is completed, the results cannot be relied
on.  The 'restart' command is not the only way that an admin may
programmatically stop and start a service; you might do this with something
based on puppet, for instance, with the intent of having the service fully
stopped before you edit its state, then restart it afterwards, so a race
here can even lead to corruption.

Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek@ubuntu.com                                     vorlon@debian.org

Reply to: