Rok,

> Well... that didn't work out as planned... the smtp server keeps
> deferring the email even though the system load is quite low and
> according to zabbix, an average of 99.24 instances of amavis is free in
> the last 12 hours (min is 95 and max is 100), the system load is 0.70...
> [...]
> I've changed the $log_level to 5 for the time being... Hopefully I'll be
> able to do some debugging today as the server isn't used as much due to
> the holiday...

I'm not aware that such behaviour has ever been reported, so I can only
guess.

Perhaps the first thing to verify is: try telneting (repeatedly) to
amavisd port and see if you always get a greeting message soon,
or are you stuck on most attempts.

Handling of accept(2) on sockets and locking/serialization is entirely
under control of a Net::Server module. Below is a patch to add logging
to Net/Server/PreForkSimple.pm, so that we could see at which point
a child process is stuck. These log lines would appear in the amavis
log at level 5, e.g.: 

 amavisd.conf:
$log_level = 5;
$DO_SYSLOG = 1;
$syslog_ident = 'amavis';
$syslog_facility = 'user';

 syslog.conf:
user.notice           /var/log/amavisd.log
user.info             /var/log/amavisd-info.log
user.debug,mail.info  /var/log/amavisd-debug.log

$ tail -f /var/log/amavisd-debug.log | fgrep 'Net::Server: accept:'



--- Net/Server/PreForkSimple.pm~        2010-05-05 05:01:58.000000000 +0200
+++ Net/Server/PreForkSimple.pm 2010-11-02 12:40:11.000000000 +0100
@@ -248,24 +248,28 @@
 
   ### serialize the child accepts
   if( $prop->{serialize} eq 'flock' ){
+    $self->log(4,"accept: waiting on a flock");
     while (! flock($prop->{lock_fh}, Fcntl::LOCK_EX())) {
       next if $! == EINTR;
       $self->fatal("Couldn't get lock on file \"$prop->{lock_file}\" [$!]");
     }
 
   }elsif( $prop->{serialize} eq 'semaphore' ){
+    $self->log(4,"accept: waiting on a semaphore");
     $prop->{sem}->op( 0, -1, IPC::SysV::SEM_UNDO() )
       || $self->fatal("Semaphore Error [$!]");
 
   }elsif( $prop->{serialize} eq 'pipe' ){
+    $self->log(4,"accept: waiting on a pipe read");
     scalar <_WAITING>; # read one line - kernel says who gets it
   }
 
 
+  $self->log(4,"accept: lock acquired, doing an accept");
   ### now do the accept method
   my $accept_val = $self->SUPER::accept();
 
-
+  $self->log(4,"accept: accept done, releasing a lock");
   ### unblock serialization
   if( $prop->{serialize} eq 'flock' ){
     flock($prop->{lock_fh}, Fcntl::LOCK_UN());
@@ -278,6 +282,7 @@
     print _READY "Next!\n";
   }
 
+  $self->log(4,"accept: lock released");
   ### return our success
   return $accept_val;
 



One other thing you may try: replace the flock serialization on a
socket with a semaphore. It requires modules IPC::SysV and IPC::Semaphore.
To let amavisd use it, search for 'serialize' in amavisd and change:
  serialize  => 'flock',     # flock, semaphore, pipe
into a:
  serialize  => 'semaphore',

On a normal system both mechanisms achieve the same and cost about
the same.

  Mark

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/amavis-user 
 Please visit http://www.ijs.si/software/amavisd/ regularly
 For administrativa requests please send email to rainer at openantivirus dot 
org

Reply via email to