Postfix/amavis issue

I am hoping someone can help me. I have been running a Linode 512 for approximately 1 year and in the last couple of weeks the server is having issues. It is a LAMP server also running Postfix, Dovecot and MySQL on Ubuntu 10.04. In addition I run SpamAssassin and Amavis. The issue is intermittently Amavis can no longer get a connection to localhost and all emails are refused with error messages as these

Aug 14 21:49:10 mail postfix/smtp[1032]: connect to 127.0.0.1[127.0.0.1]:10024: Connection refused

In addition, CPU usage and I/O spikes around the time these problems occur. I am not sure if the CPU and I/O issue cause the problem or vice versa the problem causes the CPU and I/O issues. I have tried adjusting the number of concurrent Amavis processes with not much luck. Also, when I do a top command it doesn't show either CPU or memory maxed out. I am both a newbie at Linux sysadmin and lost at this point. Any help would be much appreciated.

Thanks,

George

The mail server went down tonight and I found one additional clue in the log which looks like it ran out of memory

Aug 19 21:47:47 mail amavis[18888]: (!)Net::Server: 2012/08/19-21:47:31 Bad fork [Cannot allocate memory]\n at line 166 in file /usr/share/perl5/Net/Server/PreForkSimple.pm

Aug 19 21:47:50 mail amavis[18888]: Net::Server: 2012/08/19-21:47:48 Server closing!

Running out of memory late Sunday night seems odd since the server is working under a light load. Regardless, I bought another 90Mb but the server immediately consumed it.

Any suggestions on how to deal with this would be much appreciated.

Thanks

George

3 Replies

Newb here taking a shot at this one since I'm thinking of setting up something similiar.

Based on thread #12 of this post it seems like you are running OOM

Edit: But you purchased more memory it was consumed immediately. I wonder if you purchased enough?

Not knowing anything about your setup, my initial suspicion would be that Apache is consuming all available memory. To control this, make sure MaxClients is set to a reasonable value (5 to 25 depending on how heavyweight your web application is).

I am definitely running out of memory - here is a log entry from yesterday

Aug 19 21:47:47 mail amavis[18888]: (!)Net::Server: 2012/08/19-21:47:31 Bad fork [Cannot allocate memory]\n at line 166 in file /usr/share/perl5/Net/Server/PreForkSimple.pm

I played around with apache settings and I am setup now as follows after tweaking it several times.

StartServers 1

MinSpareServers 3

MaxSpareServers 9

ServerLimit 9

MaxClients 9

MaxRequestsPerChild 3000

Also I raised the swap file size to be equal to the RAM size. I realize Linode recommends 1/2 RAM size but that seemed not to be enough as SWAP was filled up within 1/2 hour of running at the recommended value.

Also the max memory for Php was 128M which I lowered to 64M. This did not have much impact but none of the sites on the server need more than 64M so it seemed like a reasonable setting to change to.

With the current settings it's running OK right now and hopefully it remains so but only time will tell since the problem is intermittent.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct