start/stop hook guarantees

Gustavo Niemeyer gustavo at
Sat Dec 3 17:01:56 UTC 2011

This all makes sense to me, William. Thanks for the write up and the heads up.

On Fri, Dec 2, 2011 at 15:23, William Reade <william.reade at> wrote:
> Following up on a team discussion in G+ yesterday:
> We agreed that we should always call the start hook whenever the machine
> restarts, regardless of the current state. This feels similar enough to
> an API change that we should probably get it discussed/recorded here.
> So, consider this fair warning and/or opportunity to complain:
> If the machine running your charm is restarted, we guarantee that the
> charm's start hook will be called once as soon as its unit agent first
> comes up. However, if it's just the unit agent being restarted, your
> service will not be notified at all.
> Note that we can't guarantee that the stop hook will be called on
> shutdown, but it will be if the unit agent is shut down cleanly (which
> it should be, in the case of a controlled shutdown or restart); ie, we
> can't make any guarantees about the state of the service at the time the
> start hook is called.
> In my personal opinion, this should affect a properly-written charm not
> one jot; this is because juju doesn't track what your service is
> *actually* doing, and is not capable of detecting that it has fallen
> over, and so -- if you want your charm to be robust -- you'll want to be
> running it under upstart (or similar) anyway, and will therefore likely
> already be coming up automatically on boot; and you will of course have
> made all your hooks properly idempotent.
> If you're writing a slightly lazier charm [0], though, this should be
> helpful behaviour.
> Does anyone have any comments or objections before I go ahead and
> implement this?
> Cheers
> William
> [0] Or, I suppose, one for a freakishly robust service :-p.
> --
> Juju mailing list
> Juju at
> Modify settings or unsubscribe at:

Gustavo Niemeyer

-- I'm not absolutely sure of anything.

More information about the Juju mailing list