slapd process failure is not detected by systemd
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
openldap (Debian) |
Fix Released
|
Unknown
|
|||
openldap (Ubuntu) |
Fix Released
|
Medium
|
Heitor Alves de Siqueira | ||
Xenial |
Fix Released
|
Medium
|
Heitor Alves de Siqueira | ||
Bionic |
Fix Released
|
Medium
|
Heitor Alves de Siqueira | ||
Cosmic |
Fix Released
|
Medium
|
Heitor Alves de Siqueira |
Bug Description
[Impact]
Systemd service reports slapd as active, even though it may have failed
[Description]
The slapd package for OpenLDAP is shipped with a SysV-style init script (/etc/init.
If the slapd daemon process exits due to some failure (e.g., it receives a SIGTERM or SIGKILL), the failure is not detected properly by systemd. The service is still reported as active even though the child (daemon) process has exited with a signal.
We can easily fix this by including a proper systemd service file for slapd in the openldap package. Since the init.d script already does most of the necessary work (parsing configs, setting up PID files, etc.), we don't need anything complicated for the systemd unit file. Just making sure that RemainAfterExit is set to "no" makes the systemd service behave in the expected way.
[Test Case]
1) Deploy a disco container
$ lxc launch images:ubuntu/disco disco
2) Install slapd
ubuntu@disco:~$ sudo apt update && sudo apt install slapd -y
3) Verify that slapd is running with the auto-generated service
ubuntu@disco:~$ systemctl status slapd
● slapd.service - LSB: OpenLDAP standalone server (Lightweight Directory Access Protocol)
Loaded: loaded (/etc/init.d/slapd; generated)
Active: active (running) since Fri 2019-03-22 11:51:22 UTC; 40min ago
Docs: man:systemd-
Process: 1103 ExecStart=
Tasks: 3 (limit: 4915)
Memory: 712.6M
CGroup: /system.
└─1109 /usr/sbin/slapd -h ldap:/// ldapi:/// -g openldap -u openldap -F /etc/ldap/slapd.d
4) SIGKILL the slapd process (PID is displayed in systemctl status output)
ubuntu@disco:~$ sudo kill -9 1109
5) Check if systemd service lists slapd as still active, even though it was terminated
ubuntu@disco:~$ systemctl status slapd
● slapd.service - LSB: OpenLDAP standalone server (Lightweight Directory Access Protocol)
Loaded: loaded (/etc/init.d/slapd; generated)
Active: active (exited) since Fri 2019-03-22 11:51:22 UTC; 42min ago
Docs: man:systemd-
Process: 1103 ExecStart=
6) Check if systemd has loaded both /run/systemd/
$ systemctl cat slapd
[Regression Potential]
The regression potential for this fix should be very low, if we keep the new systemd unit file close to the one generated by systemd-
Changed in openldap (Ubuntu Xenial): | |
status: | New → Confirmed |
Changed in openldap (Ubuntu Bionic): | |
status: | New → Confirmed |
Changed in openldap (Ubuntu Cosmic): | |
status: | New → Confirmed |
Changed in openldap (Ubuntu Xenial): | |
assignee: | nobody → Heitor R. Alves de Siqueira (halves) |
Changed in openldap (Ubuntu Bionic): | |
assignee: | nobody → Heitor R. Alves de Siqueira (halves) |
Changed in openldap (Ubuntu Cosmic): | |
assignee: | nobody → Heitor R. Alves de Siqueira (halves) |
Changed in openldap (Ubuntu Xenial): | |
importance: | Undecided → Medium |
Changed in openldap (Ubuntu Bionic): | |
importance: | Undecided → Medium |
Changed in openldap (Ubuntu Cosmic): | |
importance: | Undecided → Medium |
tags: | added: sts-sponsor |
Changed in openldap (Debian): | |
status: | Unknown → New |
description: | updated |
tags: | added: sts-sponsor-ddstreet |
tags: | removed: sts-sponsor sts-sponsor-ddstreet |
Changed in openldap (Debian): | |
status: | New → Fix Released |
The attachment "debdiff for disco" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.
[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]