Atmail mail server with orphaned exim processes

Written by - 0 comments

Published on - Listed in Mail Linux


On some Atmail mail servers I've experienced issues with orphaned exim processes which continued to run even after a stop or restart of exim (through the Atmail init script /etc/init.d/atmailserver). Some of the servers even had hundreds of exim processes just running without actually doing anything:

atmlsrv05: 4
atmlsrv10: 14
atmlsrv02: 155
atmlsrv08: 204
atmlsrv14: 505
atmlsrv15: 221
atmlsrv11: 267
atmlsrv03: 238
atmlsrv09: 205
atmlsrv13: 319
atmlsrv12: 220
atmlsrv06: 11
atmlsrv07: 339
atmlsrv01: 468
atmlsrv04: 317

Usually this shouldn't cause issues (except slight performance degradation) but I've seen one case where SMTP connections were refused when more than 1200 exim processes were hanging around.

The biggest issue however is not that there are these orphaned processes around, but rather that the atmailserver init script does not kill them correctly when a stop command was launched:

/etc/init.d/atmailserver stop
Stopping Atmail server: av-module imap pop3 smtp spamassassin log-daemon

ps aux | grep -c exim
436

I modified the atmailserver init script to check for remaining exim processes after the exim daemon was killed and kill them all.
Here's the patch:

*** /etc/init.d/atmailserver    2012-08-24 05:23:14.717582184 +0000
--- /tmp/atmailserver   2014-03-05 08:52:54.168978274 +0000
*************** stop)
*** 65,70 ****
--- 65,74 ----
                echo -n " smtp"
                kill -9 `cat /usr/local/atmail/mailserver/spool/exim-daemon.pid`
                rm -f /usr/local/atmail/mailserver/spool/exim-daemon.pid
+
+               # were really all exim processes killed? seen orphaned procs in the past...
+               # 2014-03-05 Claudio Kuenzler
+               if [[ -n $(pgrep exim) ]]; then pkill -9 exim; fi
        fi
 
        if test -f /usr/local/atmail/spamassassin/spamd.pid

When I now launch /etc/init.d/atmailserver stop, all exim processes are correctly killed:

/etc/init.d/atmailserver stop
Stopping Atmail server: av-module imap pop3 smtp spamassassin log-daemon

ps aux | grep -c exim
1

The remaining (1) process is the "grep" command itself.


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.