[Mimedefang] SA doesn't remove bayes lockfile when recieving TERM signal?

Dave Ellenberger d.ellenberger at nofuture.ch
Sat Oct 25 16:53:56 EDT 2003


Hi there

I guess my problem is is a bit off-topic, since it's based on SA:

I have enabled autolearn in sa-mimedefang and I have defined a memory
limit (let's say MX_MAX_AS=80000) in the init-script.

Now the memory limit was reached when running SA. The child is beeing
killed and forked again, the filter is temp failing - no biggie (since
it doesn't happen that often). A new mail is incoming - it's a ham mail,
SA want's to learn it, but the bayes database is still locked.

$ tail -f /var/log/mail
Oct 21 23:43:13 hostname sm-mta[23596]: h9LLhDPL023596:
from=<user at domain.com>, size=447, class=0, nrcpts=1,
msgid=<000001c3981c$59b47210$0b00000a at loser>, proto=ESMTP, daemon=MTA,
relay=wks01 [10.0.0.11] Oct 21 23:43:19 hostname mimedefang-multiplexor:
Slave 4 stderr: Out of memory! Oct 21 23:43:19 hostname
mimedefang-multiplexor: Slave 4 stderr: Out of memory! Oct 21 23:43:20
hostname mimedefang-multiplexor: Slave 4 ran out of memory -- possible
DoS attack due to complex MIME? Oct 21 23:43:20 hostname
mimedefang-multiplexor: Reap: Idle slave 4 (pid 21425) exited normally
with status 1 (SLAVE DIED UNEXPECTEDLY) Oct 21 23:43:20 hostname
mimedefang-multiplexor: Slave 4 resource usage: req=19, scans=4,
user=10.050, sys=0.480, nswap=0, majflt=7918, minflt=46721, maxrss=0,
bi=0, bo=0 Oct 21 23:43:20 hostname mimedefang[23597]: Error from
multiplexor: ERR No response from slave Oct 21 23:43:20 hostname
sm-mta[23596]: h9LLhDPL023596: Milter: data, reject=451 4.7.1 Please try
again later Oct 21 23:43:20 hostname sm-mta[23596]: h9LLhDPL023596:
to=<user2 at domain.com>, delay=00:00:07, pri=30447, stat=Please try again
later Oct 21 23:43:22 hostname mimedefang-multiplexor: Starting slave 4
(pid 23603) (2 running): Bringing slaves up to minSlaves (2) Oct 21
23:43:30 hostname mimedefang-multiplexor: Slave 3 stderr: Cannot open
bayes databases /etc/defang/.spamassassin/bayes_* R/W: lock failed: File
exists

Shoudn't spamassassin (when recieving a TERM signel) remove the bayes
lockfile before dying? Is this a SA version 2.60 bug? Is there a good
solution?

I could or course write an ugly mimedefang-filter based work arround,
something like: # could this line work in mimedefang-filter?
$SIG{TERM} = sub { &cleanup();    };

sub cleanup {
  if ($hits <= $autolearnvalue) {
    if ((-e $bayeslockfile) {
      # Or I could additionaly check if the bayes.lock is older than 1
minute?
      ulink($bayeslockfile);
      }
    }
  }
}

BTW: I don't have much idea about file locking. But why is SA using lock
file locking instead of flock or fcntl? Would this problem remain even
if I would change SA to use flock or fcntl?

-Dave



More information about the MIMEDefang mailing list