Bug#887064: [sendmail] persistent queue runners in split daemon mode missed by /etc/init.d/sendmail
Package: sendmail-bin
Version: 8.15.2-8
Tags: patch
When sendmail is configured with persistent queue runners *and* the
queue runner control process is separate from the main MTA daemon,
/etc/init.d/sendmail fails to find the queue runner control process and
deletes the pid file after startup. This results in the queue runners
not being terminated at shutdown or restart.
Here's how to reproduce this behaviour:
Activate persistent queue runners e.g. by setting
QUEUE_INTERVAL="p1m";
in /etc/mail/sendmail.conf
Make sure that "split daemon" mode is active, i.e. that the MTA listener
daemon is a separate process from queue runner control (otherwise the
bug does not show). Among other situations, this is the case when
QUEUE_PARMS is different from DAEMON_PARMS. For debugging purposes,
just set some option such as
QUEUE_PARMS="-O QueueFactor=600000";
in /etc/mail/sendmail.conf
Run sendmailconfig; /etc/init.d/sendmail restart
At this point, the MTA listener daemon and queue control
pids should be recorded in /run/sendmail/mta/sendmail.pid and
/run/sendmail/mta/queue.pid, respectively. However, /etc/init.d/sendmail
has checked for the queue control process after startup, was unable to
find it, and has deleted /run/sendmail/mta/queue.pid.
Run /etc/init.d/sendmail stop
At this point, there should be no more sendmail processes; in fact,
both the queue runner control process and all configured queue runners
are still present.
I believe the problem results from Debian calling the sendmail binary
as "sendmail-mta" while /etc/init.d/sendmail checks for a process with
an executable called "sendmail". Patching /etc/init.d/sendmail to
check for sendmail-mta in this particular case (split-daemon mode and
persistent queue runners) seems to fix the problem for me. Other ps
invocations in /etc/init.d/sendmail do not select by binary names and
are thus not affected.
Here's a patch:
--- etc/init.d/sendmail.orig 2016-12-08 17:43:49.000000000 +0000
+++ etc/init.d/sendmail 2018-01-13 08:06:45.350670214 +0000
@@ -289,7 +289,7 @@
if [ -z "$qp" ]; then
chmod 0664 $MTAQ_PIDFILE;
else
- qc=`ps --no-headers -fCsendmail \
+ qc=`ps --no-headers -fCsendmail-mta \
| egrep -e 'Queue control' \
| awk '{print $2}'`;
if [ -z "$qc" ]; then
Reply to: