Bug 4156 - daemon/daemon.c: Fix systemd service manager state change notification
daemon/daemon.c: Fix systemd service manager state change notification
Status: RESOLVED FIXED
Product: unbound
Classification: Unclassified
Component: server
unspecified
x86_64 Linux
: P5 enhancement
Assigned To: unbound team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-09-15 22:28 CEST by Robert Edmonds
Modified: 2018-09-17 14:31 CEST (History)
2 users (show)

See Also:


Attachments
0001-daemon-daemon.c-Fix-systemd-service-manager-state-ch.patch (2.28 KB, patch)
2018-09-15 22:28 CEST, Robert Edmonds
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Edmonds 2018-09-15 22:28:59 CEST
Created attachment 525 [details]
0001-daemon-daemon.c-Fix-systemd-service-manager-state-ch.patch

Unbound release 1.8.0 introduced a bug in the upstream commit "Fix
use-systemd readiness signalling, only when use-systemd is yes and not 
in signal handler" which only performs service manager state change
notification when "use-systemd: yes" is set, which controls whether
systemd socket activation is used, according to the unbound.conf
manpage.

On Debian, since we use [Service] Type=notify in the unbound.service
unit, this causes unbound starts/restarts to hang and timeout under
1.8.0, because "use-systemd: yes" (i.e., socket activation) is not 
enabled, and unbound then fails to send the state change notification.
When unbound is compiled with systemd support, it should always
sd_notify() regardless of any settings in unbound.conf, because the 
process startup type is controlled by the service unit, not by the 
unbound.conf file, and sd_notify()'ing when not running under a
Type=notify service unit is harmless.

This commit restores the previous behavior which was introduced by
Vincent Bernat in the fix for Debian bug #892914 [0] and applied to
upstream unbound in [1].

[0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=892914

[1] https://www.nlnetlabs.nl/bugs-script/show_bug.cgi?id=4108
Comment 1 Wouter Wijngaards 2018-09-17 14:31:19 CEST
Hi Robert,

Thank you for the patch.  I did not know this is how that worked, but changed the code after people said the previous patch caused crashes, when I introduced similar code in NSD.  That I can also fix like this.

Best regards, Wouter