[systemd-devel] [PATCH] Avoid reloading services when shutting down

Lennart Poettering lennart at poettering.net
Tue Feb 3 12:40:37 PST 2015


On Tue, 03.02.15 20:36, Martin Pitt (martin.pitt at ubuntu.com) wrote:

> Lennart Poettering [2015-02-03 18:10 +0100]:
> > I am very strongly against adding hacky work-arounds like this to PID
> 
> Yeah, indeed. This is why I asked for a more elegant approach, and
> indeed the --no-block or --job-mode=ignore-dependencies sound like
> slightly better approaches to this. I'll test these more thoroughly
> tomorrow, thanks for pointing out!
> 
> > 1. The deadlocks are deadlocks, and implying --no-block if we are in
> > shutdown mode is a pretty drastic hack I think that special cases one
> > peculiar case way too much.
> 
> Right, the problem is of course more generic. Any set of jobs (i. e. a
> transaction) which causes (maybe through some indirection) one of its
> job members to get restarted/reloaded will suffer from this deadlock
> problem, AFAIUI. Booting and shutdown are therefore mostly affected by
> this as pretty much every other time there the pending transactions
> are only very small.

It's really about synchronous waiting on jobs. If you synchronously
wait for completion of jobs that are ordered against the job your are
part of yourself, then things will deadlock. This can happen in many
contexts. You can fix this by:

     a) changing from synchronous to asynchronous operation

     or 

     b) removing the ordering (either individually for the job, or
        generically forever in the unit)

Now, regardless which option you choose it's always a good idea to
keep this change as local as possible. Altering the state engine for
all operations is the worst solution...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list