Bug 44782 - RFE: support ReloadSignal= instead of /bin/kill
Summary: RFE: support ReloadSignal= instead of /bin/kill
Status: RESOLVED WONTFIX
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: Lennart Poettering
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-14 07:27 UTC by Michał Górny
Modified: 2012-01-23 04:49 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Michał Górny 2012-01-14 07:27:14 UTC
Considering that /bin/kill is a custom executable provided by procps package (at least on Gentoo), and at some point it will be supposedly moved to /usr/bin, relying on it in ExecReload= doesn't seem like a good idea.

Thus, I suggest adding ReloadSignal= (similar to KillSignal=).

Then, the reload would work the following way:
1) if ExecReload= is specified, run that;
2) if ReloadSignal= is specified, send that signal to $MAINPID,
3) otherwise, no reload supported.
Comment 1 Lennart Poettering 2012-01-16 09:21:47 UTC
This has come up before, but I am still against it.

I believe that reload-by-SIGHUP is not a desirable interface. Maybe in addition to something else to make things easy for the admin, but it should not be emphasized as the ideal interface for realoading by supporting it explicitly in systemd. Why? Simply because it's asynchronous: we just enqueue the reload but systemd does not know when it finished and the new configuration has been applied. What we want here is a synchronous reload: where systemd's service state machine actually reflects when the reload is complete and we can synchronize other jobs to that.

Now, in some cases a synchronous reload is not available, and in some cases it's irrelevant to distuingish between synchronous/asynchronous reloads for a service (and in those cases people can just invoke /bin/kill), but this still means that we shouldn't suggest people to use SIGHUP for reloading by making it natively supported in the service logic.

The right interface for reloading of a daemon could be anything synchronous, for example a dbus call, or suchlike. 

Sorry that I am against this, but I hope this explanation makes some sense.
Comment 2 Michał Górny 2012-01-16 12:17:24 UTC
Ok, I guess you're right. Do you have any ideas how to handle depending on external apps better?

I don't think it's really desirable to hardode paths, and using $bindir in paths to external programs doesn't seem better at all (because the required apps could be installed in any other prefix). Well, I think we'll end up using /usr/bin/env (if systemd exports useful PATH).
Comment 3 Lennart Poettering 2012-01-20 19:12:57 UTC
I don't think that /bin is likely to go away anytime soon, so I'd just go and use that path for now.

Actually I guess I should take back a bit of what I wrote here earlier. I think SIGHUP for reload can work, if we combine it with a response in some way. And there's actually something that has been suggested in a different context that might do the job nicely here: that we extend sd_notify() to allow signalling when reloading begins/ends. That way a daemon could:

a) tell us when it starts reloading, even if this was triggered from outside systemd, simply by sending sd_notify("RELOADING=1");

b) tell us when it finishes reloading, regardless how that was triggered, by sending sd_notify("RELOADING=0");

If we had that we could introduce ReloadSignal= in a safe way (and I added this now as a follow-up feature for the sd_notify() extension to the TODO list. Of course, it wouldn't work on services that have not been patched to use sd_notify().

Anyway, I hope this makes some sense.
Comment 4 Michał Górny 2012-01-21 00:44:50 UTC
(In reply to comment #3)
> I don't think that /bin is likely to go away anytime soon, so I'd just go and
> use that path for now.

We don't intend to symlink it in Gentoo, so if any packages move to /usr, we have to keep individual symlinks. I'd rather decrease the need for that as much as possible.

> If we had that we could introduce ReloadSignal= in a safe way (and I added this
> now as a follow-up feature for the sd_notify() extension to the TODO list. Of
> course, it wouldn't work on services that have not been patched to use
> sd_notify().

Does that mean that ReloadSignal= will work with services which don't support sd_notify() as well? IOW, just assuming these services don't support signaling like they do now with ReloadExec=.
Comment 5 Lennart Poettering 2012-01-23 04:49:14 UTC
(In reply to comment #4)
> (In reply to comment #3)

> > If we had that we could introduce ReloadSignal= in a safe way (and I added this
> > now as a follow-up feature for the sd_notify() extension to the TODO list. Of
> > course, it wouldn't work on services that have not been patched to use
> > sd_notify().
> 
> Does that mean that ReloadSignal= will work with services which don't support
> sd_notify() as well? IOW, just assuming these services don't support signaling
> like they do now with ReloadExec=.

Well, my first thou8ght would be: yes, we only would work with those using sd_notify(). But then again, it might make sense to make that part optional, if we have the code anyway... I guess that's something to revisit, when we actually implement it...


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.