On 23 Sep 2017, at 20:37, Michael Fox wrote:

Thanks Bill,

After some more research I found the bug and I think I've "fixed" it. See below.

Option 1:  Use inet socket
------------------------------------------------
/etc/default/mimedefang:
    SOCKET=inet:8899@localhost

/etc/postfix/main.cf
    smtpd_milters = inet:localhost:8899

This works for Ubuntu 14.04/MIMEDefang 2.73.
But it fails with Ubuntu 16.04/MIMEDefang 2.78. If Postfix is already
running, and MIMEDefang is restarted, I get the following in
/var/log/mail.err:

     mimedefang[27605]: MIMEDefang-2.78: Unable to bind to port
inet:8899@localhost: Address already in use
     mimedefang[27605]: MIMEDefang-2.78: Unable to create listening
socket on conn inet:8899@localhost

That's odd. Given your other options, I'd try to figure out what exactly is going on here and fix it. I.e. what process actually has taken that
port.

Yes, odd.

I've continued to research and just found this, which is my problem.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=807078

The problem occurs for me in MIMEDefang 2.78 (package for Ubuntu 16.04), which is the version reported in the above bug. Apparently, the problem is that when using "systemctl restart mimedefang" it doesn't wait for itself to completely stop before it tries to start again. And I can confirm that. If I use "systemctl stop ...", then wait for it to stop, then "systemctl start ...", then it works.

I kinda wanted to blame the abomination of systemd and/or the Debian/Ubuntu packagers who regularly 'fix' things that are not broken but since I had nothing more solid than my own bile, I refrained...

The bug report says it's fixed in v2.79 and v2.79 is in the Ubuntu 17.04 package. According to https://ubuntu.pkgs.org/17.04/ubuntu-universe-i386/mimedefang_2.79-2_i386.deb.html , on 2016-12-23 the init stop action was changed to always wait.

As the "restart" action has been in the distribution's included init scripts for as long as I've used MD (over a decade) and I suspect forever. There's no rationale I can think of to always wait on a 'stop' action but it isn't really harmful, beyond delaying shutdown for (normally) a few seconds.

So here's what I did to "fix" it in Ubuntu 16.04/MIMEDefang 2.78:

In /etc/init.d/mimedefang, in the stop_it() function:

    #    if [ "$1" = "wait" ] ; then
    ....
    #    fi

In other words, just comment out the conditional wait so that the "waiting" part inside the IF statement always runs.

When I tried to run systemctl restart mimedefang, I got:
Warning: mimedefang.service changed on disk. Run 'systemctl daemon-reload' to reload units.

So, I did that. And then: systemctl restart mimedefang seems to work just fine.

I'd appreciate it if any of the developers can verify that what I did shouldn't cause some other unintended consequence.

Dianne will likely give a definitive authoritative answer but having adapted the MD startup script to multiple system control environments, I don't see anything especially risky. The only potential issue I can think of is if you're trying to shut down or reboot in a pathological circumstance where the mimedefang.pl worker perl sub-processes refuse to exit and the supervisory process (e.g. init) has no last resort mechanism to arbitrarily slaughter hung children. There's nothing quite so annoying as a "hung going down" system.

_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to