[systemd-devel] Deadlocks with reloading jobs which are part of current transaction [was: [PATCH] Avoid reloading services when shutting down]
Martin Pitt
martin.pitt at ubuntu.com
Wed Feb 4 08:45:20 PST 2015
Lennart Poettering [2015-02-04 16:38 +0100]:
> Sure, I can only recommend again: in the the glue code that calls out
> to "systemctl" from "service", you can add the code to use --no-block
> or --job-mode=ignore-dependencies , if you notice you are in shutdown
> mode...
Yeah, I agree that given all the options that's the best heuristics
for now.
> > > Modern code, that talks directly to systemctl, that uses hook scripts,
> > > should always use --no-block for these cases.
> >
> > Yeah, for sure. We just don't have that luxury easily, as first these
> > scripts don't call systemctl but "service" (for the Debianists: or
> > invoke-rc.d, but same difference), it will take some time to find
> > all these occurrences, and people will hate us for having to add stuff
> > like
> >
> > if (running under systemd)
> > systemctl --no-block reload foo
> > else
> > service foo reload
>
> I am not proposing anything like that.
Right, this was just a reply to "modern code that talks directly to
systemctl", and we can't do that while we support more than one init
system. Sorry for the misunderstanding.
> > > > - Don't enqueue a reload if the service to be reloaded isn't running.
> > > > E. g. postfix.service "inactive/dead" in
> > > > https://bugs.debian.org/635777 or smbd.service "start/waiting" in
> > > > https://launchpad.net/bugs/1417010. This would completely avoid
> > > > the deadlock in most situations already, and doesn't change the
> > > > semantics for working use cases either, so this should even be
> > > > applicable for upstream?
For the record, this was already discussed here:
http://lists.freedesktop.org/archives/systemd-devel/2014-July/021457.html
continuation:
http://lists.freedesktop.org/archives/systemd-devel/2014-August/022048.html
> I mean, if you want precise sysv semantics you can just use
> --job-mode=ignore-dependencies always, since sysv ignore all deps too
> when sysv scripts are involved.
"Always" sounds rather unsafe to me, as we would totally ignore a
unit's Requires/Wants= then. Doing it if !systemctl is-system-running
sounds ok.
> I'd strongly encourage you to work around this on client side in the
> sysv glue, not breaking the guarantess that systemd-aware code needs
> when issuing commands.
Yes, I prefer that as well. (That's what I meant with "distro side"..)
Thanks,
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
More information about the systemd-devel
mailing list