Amavisd cant fork with a lot of emails

Mark Martinec Mark.Martinec+amavis at ijs.si
Fri Feb 24 12:20:20 CET 2012


Antonio,

> First of all, sorry if this is not the right place to ask this
> question. We are setting upan antispam server using spamassassin,
> maia, amavisd-new, etc. All is ok. But, once in a while, we have
> problems in amavis, when create a new process to check attached data
> in an email.
> 
> We are getting an strange message on postfix logs after a while. The
> message is like that:
> 
> (host 127.0.0.1[127.0.0.1] said: 451 4.5.0 Error in processing,
> id=11968-01-10, mime_decode-1 FAILED: run_command (open pipe):
> 
> Can't fork at /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/IO/File.pm
> line 188. at /usr/sbin/amavisd line 1657. (in reply to end of DATA
> command))  YYYYY <at> foo.bar
> 
> I am afraid that the problem is there isn't enough resources to
> allocate a new thread. The message goes to the deferred queue. The
> problem is, that when its occurs, the deferred queue starts to
> increase quickly, and the memory goes down quickly also. For this
> reason I have configured via limits.conf to increase the process on
> the * account, but it doesnt works:
> 
> /etc/security/limits.conf
> 
> *       soft    nofile  65535
> *       hard    nofile  65535
> *       soft    nproc   65535
> *       hard    nproc   65535
> 
> Amavis is running under the amavis user account. My server is a SLES
> 11 (virtual running under VMWARE), with 4 GB of ram
> and 1,5 GB of swap. When I have this problem, the free memory quickly
> goes down, like the swap. :(((
> 
> Any ideas? So much thanks.

See man page on fork(2). Besides nproc and MAXPROC limits, the next
likely cause for failing to fork is that the system run out of
swap space. My guess is that you hit the swap space exhaution,
and from then on things can only get worse. Make sure to have
sufficient swap space. It is common to allocate twice or four times
the size of RAM to swap.

  Mark


More information about the amavis-users mailing list