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

Lennart Poettering lennart at poettering.net
Tue Feb 3 15:14:54 PST 2015


On Tue, 03.02.15 23:03, Michael Biebl (mbiebl at gmail.com) wrote:

> > While I just made this scenario up I think it's actually quite
> > realistic, and I think it's a valid thing for admins to do....
> 
> Well, we could easily check if DefaultDependencies=yes in this case.
> Actually, this is already what we do for the boot case. [1]
> 
> So even with your made-up example, it would work.
> 
> >> The thing is, you have to be extra careful to never, ever call a
> >> restart/reload from such hook scripts. If those are triggered via
> >> service or systemctl on a native or SysV script doesn't make a
> >> difference.
> >
> > It is completely fine to enqueue restarts and reloads from hook
> > scripts. However the emphasis is on *enqueue*. The issue is that you
> > block on it, you shouldn't do that.
> >
> > On Fedora, iscsi is reloaded from an NM callout. If you ask me that's
> > frickin' ugly, but it *is* supported as long as iscsi's reload is
> > queued asynchronously instead of requested synchronously. In Fedora,
> > the logic to make this async sits on the client side of things, it's
> > not enforced by the engine in PID 1.
> >
> > The same really applies to Debian too...
> >
> >> It's simply to easy to cause a dead lock this way, and I think systemd
> >> should try much harder to avoid such situations.
> >
> > Well, it would be great if we could solve the halting problem. But we
> > can't.
> >
> > I mean, I am all ears regarding adding deadlock detection code. But I
> > am really not convinced that breaking the engine for *everybody* just
> > because *some* clients are weird is an option.
> 
> Calling it "breaking the engine for everybody" is hyperbole.
> 
> That said, do you have better ideas how we could avoid having systemd
> easily being dead-locked on shutdown?
> I'm all for solving it in a nicer way. But simply throwing the hands
> in the air and saying, not our problem, doesn't help.

I made a clear recommendation: whenever commands are converted from
sysv operations into systemctl operations, then add --no-block or
--job-mode=ignore-deps to the systemctl command line, after checking
that you are in startup or shutdown mode. Why wouldn't that suffice?

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list