Clarification on upstart-0.5 and dbus usage

Matthias Urlichs smurf at smurf.noris.de
Thu Jun 19 06:42:39 BST 2008


Hi,

Scott James Remnant:
> On Thu, 2008-06-19 at 01:24 +0200, Matthias Urlichs wrote:
> 
> > Scott James Remnant:
> > > 	pid = instance.Get("pid")["main"]
> > > 
> > > 	# Muck around with pid as you see fit
> > > 	if os.path.isfile("/tmp/%d" % pid):
> > > 	    return
> > > 
> > > 	# Oh dear, it's broken
> > > 	instance.Restart()
> > 
> > Nice race condition there. :-P
> > 
> What's the race?

The Program starts but doesn't yet have the pidfile created,
for whatever reason.

You run the above code, killing and restarting the program
before it's ready.

Repeat.


The fix would obviously be to note that the program is in "starting"
instead of "started" state; of course, Upstart needs to notice / get
told about the transition from the former to the latter for that to
work, hence the complexity I mentioned.

But we've had this discussion before ...

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf at smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
 - -
A day ago the future had looked aching and desolate, and now it looked full
of surprises and terror and bad things happening to people... If she had
anything to do with it anyway.
        -- Granny Weatherwax commits optimism
           (Terry Pratchett, Maskerade)



More information about the upstart-devel mailing list