Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[AMaViS-user] amavisd uses lots of memory

1,298 views
Skip to first unread message

Wojtek Bogusz

unread,
Oct 25, 2008, 11:01:30 AM10/25/08
to
hi. i have a burning problem with the amavisd-new. i am running Ubuntu
with postfix + amavisd-new + maia + spamassasin + clamav + pyzor + dcc.
the server is not very strong (pentium III 550 MHz with 700 MB RAM)
since 2 days the server is stacked with the email. i have 3800 emails in
mailq. seems like amavis on 10024 does not handle the traffic. i was
monitoring the processes, normally amavis is of the size of 60-80 MB but
now it grows up to 1GB. the swap is saturated, the computer freezes, and
system kills the amavis process. and this process repeats all over
again. i am not sure what can i do to help it. the emails is the queue
show that:

- conversation with 127.0.0.1[127.0.0.1] timed out while receiving the
initial server greeting

or

- delivery temporarily suspended: lost connection with
127.0.0.1[127.0.0.1] while sending end of data -- message may be sent
more than once

please help. regards, Wojtek

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
AMaViS-user mailing list
AMaVi...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

John Andersen

unread,
Oct 25, 2008, 5:27:24 PM10/25/08
to
On Sat, Oct 25, 2008 at 8:01 AM, Wojtek Bogusz <wojtek...@gmail.com> wrote:

> i am not sure what can i do to help it.

Add memory. A properly configured server will never fill swap.

The processor is a little lightweight admittedly, but if you don't run
X on it it should do ok. How long did it take to acquire 3800 mails?


--
----------JSA---------
Someone stole my tag line, so now I have this rental.

Wojtek Bogusz

unread,
Oct 26, 2008, 6:14:35 AM10/26/08
to
hi, thank you for your email.

>>> John Andersen wrote:
> Add memory. A properly configured server will never fill swap.

i am not able to add memory right now :-( all the memory slots are
filled and it is an old computer meaning it is hard to buy new memory
for it. perhaps i need to buy a new server but this will also be at
least a week if not two.

most interesting is that amavis that consumes about 40-50 MB normally
can grow to 1GB. how can i see what is it doing. why does it grow so
large? is there a way to set it up so it cannot grow over certain size
limit?

> The processor is a little lightweight admittedly, but if you don't run
> X on it it should do ok.

you mean X windows? it is just a server no graphical interface. it has
few things on it but it was ok for most of the time.

> How long did it take to acquire 3800 mails?

it took 2 days.

is there anything i can do to change the setup of amavis?

regards, Wojtek

Wojtek Bogusz

unread,
Oct 26, 2008, 6:14:35 AM10/26/08
to

Wojtek Bogusz

unread,
Oct 26, 2008, 6:14:35 AM10/26/08
to

Bernd Probst

unread,
Oct 26, 2008, 9:16:40 AM10/26/08
to
Hi,

which value are you using for $max_requests in amavisd.conf?
Maybe it's too high, default is 20.

http://www.ijs.si/software/amavisd/amavisd-new-docs.html#max_requests
describes how to set $max_requests depending on $sa_mail_body_size_limit
from spamassassin.

Greetings Bernd

> -----Ursprüngliche Nachricht-----
> Von: Wojtek Bogusz [mailto:wojtek...@gmail.com]
> Gesendet: Sonntag, 26. Oktober 2008 11:15
> An: amavi...@lists.sourceforge.net
> Betreff: Re: [AMaViS-user] amavisd uses lots of memory

Gary V

unread,
Oct 26, 2008, 10:25:54 AM10/26/08
to
You say you are using amavisd-new and maia, but these two programs are
mutually exclusive. You run one or the other, not both. I will asume
you are running Maia. I would start with looking in your log for
errors reported by amavis. The path to your mail log may need to be
changed:

egrep "(TROUBLE|Can't|TIMED|timed|ERROR|Error|abort|error|fatal|PRESERVING|FAILED)"
/var/log/maillog | grep amavis

It could be that you you are allowing one or more very large messages
to pass through Maia. Look through your mail log at the size of the
messages passed to Maia just before it crashes. If I recall, unlike
amavisd-new, Maia unpacks messages in memory which could account for
it crashing on a large message.

http://maiamailguard.com/maia/wiki/SizeLimit

--
Gary V

Wojtek Bogusz

unread,
Oct 26, 2008, 5:27:03 PM10/26/08
to
Hi Gary, thank you for your email and help!

Gary V wrote:
> You say you are using amavisd-new and maia, but these two programs are
> mutually exclusive. You run one or the other, not both. I will asume
> you are running Maia.

you are correct with this. sorry, i run Maia and its version of the
amavisd-new. i understand that Maia patch standard amavisd-new. i have:
amavisd-new-2.2.1 and Maia Mailguard 1.0.1

> I would start with looking in your log for
> errors reported by amavis. The path to your mail log may need to be
> changed:
>
> egrep "(TROUBLE|Can't|TIMED|timed|ERROR|Error|abort|error|fatal|PRESERVING|FAILED)"
> /var/log/maillog | grep amavis

it gives a lot of output. but if i filter out 'SA TIMED OUT' mostly it
is like:

TROUBLE in check_mail: mime_decode-1 FAILED: run_command (open pipe):
Can't fork at /usr/lib/perl/5.8/IO/File.pm line 70, <GEN[Y]> line [X].
at /usr/sbin/amavisd-new line 1656, <GEN[Y]> line [X].

where [X] may be: many different numbers, like: 76, 104, 116, 1857, ...
and [Y] may be: 20, 77, 83, 87, 115, .. and many other.

/usr/lib/perl/5.8/IO/File.pm line 70 is open() a file and
/usr/sbin/amavisd-new line 1656 is chomp that must die. at 1655 is a
fork to catch the errors.
perhaps it cannot fork as it has no memory left?

and than the logs say most often:

PRESERVING EVIDENCE in /var/lib/amavis/tmp/amavis-...

when i looked at this folder there are some emails but all of them are
not large, not more than 200k

> It could be that you you are allowing one or more very large messages
> to pass through Maia. Look through your mail log at the size of the
> messages passed to Maia just before it crashes. If I recall, unlike
> amavisd-new, Maia unpacks messages in memory which could account for
> it crashing on a large message.
>
> http://maiamailguard.com/maia/wiki/SizeLimit

this doc writes about size limits:

A - postfix upstream mail server's size limit, in my case: 15M
B - MySQL's size limit (i.e. max_allowed_packet), in my case: 16M
C - Maia's size limit, in my case: 200k
D - SpamAssassin's size limit, in my case: 200k

so it is almost as they say: A >= B > C >= D well in my case B > A but i
think it should not matter.
and the limits are low... especially Maia & SA limits.


i still have no clue what to do and why amavisd-new does not process
emails...

regards, Wojtek

Gary V

unread,
Oct 26, 2008, 7:07:02 PM10/26/08
to
> it gives a lot of output. but if i filter out 'SA TIMED OUT' mostly it
> is like:
>
> TROUBLE in check_mail: mime_decode-1 FAILED: run_command (open pipe):
> Can't fork at /usr/lib/perl/5.8/IO/File.pm line 70, <GEN[Y]> line [X].
> at /usr/sbin/amavisd-new line 1656, <GEN[Y]> line [X].
>
> where [X] may be: many different numbers, like: 76, 104, 116, 1857, ...
> and [Y] may be: 20, 77, 83, 87, 115, .. and many other.
>
> /usr/lib/perl/5.8/IO/File.pm line 70 is open() a file and
> /usr/sbin/amavisd-new line 1656 is chomp that must die. at 1655 is a
> fork to catch the errors.
> perhaps it cannot fork as it has no memory left?
>
> and than the logs say most often:
>
> PRESERVING EVIDENCE in /var/lib/amavis/tmp/amavis-...
>
> when i looked at this folder there are some emails but all of them are
> not large, not more than 200k

What version of Net::Server are you running?
perl -MNet::Server -e 'print "$Net::Server::VERSION\n";'

How many $max_servers are you running? Do the number of $max_servers
match the number of maxproc for the smtp-amavis transport in
master.cf?

http://marc.info/?l=amavis-user&m=111144940508012

--
Gary V

Gary V

unread,
Oct 26, 2008, 7:52:04 PM10/26/08
to
> amavis gets up to 800 MB - 1GB :-(

My guess is that there is at least one problematic message that is
acting similar to a mail bomb. Maybe some problem with decoding. If
you grep your log for 'size'
you might see a message of one particular size that repeatedly tries
to be sent.
This might help diagnose if it is one particular message gumming up
the works or not and which message it might be.

Wojtek Bogusz

unread,
Oct 27, 2008, 4:55:26 AM10/27/08
to
hi, thank you.

> What version of Net::Server are you running?
> perl -MNet::Server -e 'print "$Net::Server::VERSION\n";'

it is 0.94. looks like 0.97 is the current version. i'll update. i will
try to update also maia + amavisd-new maybe it will help.

> How many $max_servers are you running?

2

> Do the number of $max_servers match the number of maxproc for the
> smtp-amavis transport in master.cf?

yes

> http://marc.info/?l=amavis-user&m=111144940508012

it is a swap space in my case...

> My guess is that there is at least one problematic message that is
> acting similar to a mail bomb. Maybe some problem with decoding. If
> you grep your log for 'size'
> you might see a message of one particular size that repeatedly tries
> to be sent.
> This might help diagnose if it is one particular message gumming up
> the works or not and which message it might be.

i was looking at the patterns with the size but i do not see any. looks
like the messages are dropped and the effect of swap saturation persists...

cheers, Wojtek

Wojtek Bogusz

unread,
Oct 27, 2008, 4:55:26 AM10/27/08
to

Wojtek Bogusz

unread,
Oct 27, 2008, 4:55:26 AM10/27/08
to

Mark Martinec

unread,
Oct 27, 2008, 11:21:46 AM10/27/08
to
Wojtek,

> i run Maia and its version of the amavisd-new. i understand that
> Maia patch standard amavisd-new. i have: amavisd-new-2.2.1 and
> Maia Mailguard 1.0.1

> amavis gets up to 800 MB - 1GB :-(

As Gary noted, unlike amavisd-new (which keeps mail mostly on
files and accesses a database in buffer chunks of managable size),
Maia loads the entire mail message into memory in order to
be able to store it to SQL in a single operation. This is killing
your host which is low on RAM and seemingly low on swap space too.

> TROUBLE in check_mail: mime_decode-1 FAILED: run_command (open pipe):
> Can't fork at /usr/lib/perl/5.8/IO/File.pm line 70, <GEN[Y]> line [X].
> at /usr/sbin/amavisd-new line 1656, <GEN[Y]> line [X].

> perhaps it cannot fork as it has no memory left?

Yes, fork fails when swap space is full. Increase you swap space
or reduce the number of concurrent amavisd processes, or limit
the maximum mail size at your MTA.

Mark

Wojtek Bogusz

unread,
Oct 27, 2008, 4:54:08 PM10/27/08
to
hi Mark, thank you

> Yes, fork fails when swap space is full. Increase you swap space
> or reduce the number of concurrent amavisd processes, or limit
> the maximum mail size at your MTA.

i did increase the swap space. number of the avavisd processes are 2. so
there is not much to decease. the mail size limit is 15MB. i cannot
understand how this is possible that amavisd can grow up to 1GB with the
mail limit of 15MB... regards, Wojtek

Gary V

unread,
Oct 27, 2008, 9:20:20 PM10/27/08
to
On 10/27/08, Wojtek Bogusz <wojtek...@gmail.com> wrote:
> hi, thank you.
>
> > What version of Net::Server are you running?
> > perl -MNet::Server -e 'print "$Net::Server::VERSION\n";'
>
> it is 0.94. looks like 0.97 is the current version. i'll update.

I suggest you downgrade to 0.87 or 0.90. This old version of
amavisd-maia had issues with Net::Server > 0.90 and did not play well
with 0.88 and 0.89.

> i will try to update also maia + amavisd-new maybe it will help.

You would want to upgrade to Maia 1.0.2. There are a number of posts
related to upgrading on the maia list.

http://www.renaissoft.com/pipermail/maia-users/

I suggest joining their mailing list if you have not already done so.

-
Gary V

Gary V

unread,
Oct 27, 2008, 10:40:36 PM10/27/08
to
> I suggest you downgrade to 0.87 or 0.90. This old version of
> amavisd-maia had issues with Net::Server > 0.90 and did not play well
> with 0.88 and 0.89.

Are you running Debian per chance?

If so, this should replace 0.94 with 0.87 (at least it did for me):

cd /usr/local/src

wget http://http.us.debian.org/debian/pool/main/libn/libnet-server-perl/libnet-server-perl_0.87-3sarge1_all.deb

dpkg -i libnet-server-perl_0.87-3sarge1_all.deb

Doing it this way will make it possible to upgrade in the future from
Debian packages. If you install from source, you would have to
manually locate and disable the software if you wanted to upgrade in
the future:
http://marc.info/?l=amavis-user&m=114358249713291

In my etch system, if I install 0.87 from packages and 0.90 from source:

0.90 installed in /usr/local/share/perl/5.8.8/Net/Server.pm
0.87 installed in /usr/share/perl5/Net/Server.pm

So if I wanted to disable the source installed version in the future,
I could rename
/usr/local/share/perl/5.8.8/Net/Server.pm

--

0 new messages