Hooks for a snap must not run concurrently

As we just discussed in the standup call today, hooks for any given snap should not be run concurrently with other hooks inside the same snap, because it’s much easier to make logic right this way. Without that we need to be careful about ordering of reading/writing configuration files, start/stop services, etc.

We need to make sure this is indeed the case today, or make it be the case otherwise.

Can we also document the order in which hooks (e.g.; configure) are run?

The configure hook is run by itself, so there’s no interdependent order. But yes, we will document better these details.

These points are both unrelated to the topic here, though.

I might have been confused by this, runs should be deterministic, running them non concurrently eases the logic, but running them in a specific order does too. I am conflating to a scenario which may not exist yet, but given a configure hook and an imaginary install hook, at install time, which would run first is a good answer to have (I know the install hook is a bad example, please forgive my lack of imagination at this time of day).

That said, I have no further comment.

Yeah, I get it. As I said, when you run set or install something the configure hook runs by itself. So there’s no need to worry about its ordering today. There are other hooks coming, such as those for interface connections, which will need more comprehensive documentation. We’ll make sure to write it.

1 Like

Related PR: https://github.com/snapcore/snapd/pull/3235

1 Like