[Pkg-mailman-hackers] Bug#733475: mailmanctl dies silently, messages delayed until intervention

Jan Niehusmann jan at gondor.com
Wed Oct 12 16:37:47 UTC 2016


On Wed, Oct 12, 2016 at 03:21:13PM +0200, Jan Niehusmann wrote:
> May it be that either needrestart or systemd calls the stop and start
> rules directly, instead of using the restart rule?

It looks like the way systemd calls the init script may be the issue,
here:

Systemd generates a unit file which contains:

ExecStart=/etc/init.d/mailman start
ExecStop=/etc/init.d/mailman stop

(See /var/run/systemd/generator.late/mailman.service)

There is no such thing like ExecRestart, so all systemd can do is first
calling ExecStop and then calling ExecStart, if a restart is requested.

Additionally, the documentation for ExecStop says:

"Note that it is usually not sufficient to specify a command for this
setting that only asks the service to terminate (for example, by queuing
some form of termination signal for it), but does not wait for it to do
so."

https://www.freedesktop.org/software/systemd/man/systemd.service.html

(It continues saying "Since the remaining processes of the services are
killed using SIGKILL immediately after the command exited, this would
not result in a clean stop.", which is not the issue we are having, but
still, the command given in ExecStop should wait for the service to
exit, to fulfil the expectations of systemd)

Would it hurt to add the 'wait for termination' code found in the
restart part of /etc/init.d/mailman to the stop part, as well? Like the
following?

  stop)
    log_daemon_msg "Stopping Mailman master qrunner" "mailmanctl"
    PID=`cat $PIDFILE 2>/dev/null` || true
    $DAEMON -q stop
    if test -n "$PID" && kill -0 $PID 2>/dev/null ; then
        log_action_begin_msg "Waiting"
        for cnt in `seq 1 5`; do
            sleep 1
            kill -0 $PID 2>/dev/null || break
        done;
        if kill -0 $PID 2>/dev/null ; then
            log_end_msg 1
        else
            rm -f $PIDFILE
            log_end_msg 0
        fi
    else
        log_end_msg 0
    fi
    ;;

Note that this is not really tested. Just copied from the restart
section.

Best regards,
Jan



More information about the Pkg-mailman-hackers mailing list