boka,

> i have amavid-new 2.4.2 with postfix and i have problem to stop and reload
> amavis process.
>
> [EMAIL PROTECTED]:~/amavis/amavisd-new-2.4.2# amavisd reload
> daemon terminated, waiting for the dust to settle...
> becoming a new daemon...
...
> Jul 26 14:25:40 rilej amavis[1992]: Net::Server: 2006/07/26-14:25:40 Can't
> connect to TCP port 10024 on 127.0.0.1 [Address already in use]
...
>  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
> 5481 amavis     9   0 56408  55M 54392 S    99.9 10.9   0:14   0 amavisd

Looks like the old daemon does not go away, even though it looks to amavisd
(by sending it a signal 0) that it is not longer alive. Could it be that
the pid file was overwritten by some other instance of amavisd?

The following patch makes 'amavisd reload' report the process id of
the previous daemon, and the signal name it used to kill it.
Please see if the additional information reported provides some clues:

--- amavisd.orig        Tue Jun 27 13:31:56 2006
+++ amavisd     Fri Jul 28 15:48:50 2006
@@ -9530,5 +9530,5 @@
 
 # act on command line parameters
-my($cmd) = lc($ARGV[0]);
+my($cmd) = lc($ARGV[0]); my($killed_amavisd_pid); my($kill_sig_used);
 if ($cmd =~ /^(start|debug|debug-sa|foreground)?\z/) {
   $DEBUG=1      if $cmd eq 'debug';
@@ -9552,14 +9552,20 @@
     defined($amavisd_pid) or die "Invalid PID in the $pidf";
     $amavisd_pid = untaint($amavisd_pid);
-    kill('TERM',$amavisd_pid) or die "Can't SIGTERM amavisd[$amavisd_pid]: $!";
+    $kill_sig_used = 'TERM';
+    kill($kill_sig_used,$amavisd_pid)
+      or die "Can't SIGTERM amavisd[$amavisd_pid]: $!";
     my($waited) = 0; my($sigkill_sent) = 0; my($delay) = 1;  # seconds
     for (;;) {  # wait for the old running daemon to go away
       sleep($delay); $waited += $delay; $delay = 5;
-      last  if !kill(0,$amavisd_pid);  # is the old daemon still there?
+      if (!kill(0,$amavisd_pid)) {  # is the old daemon still there?
+        $killed_amavisd_pid = $amavisd_pid;
+        last;
+      }
       if ($waited < 60 || $sigkill_sent) {
-        print STDERR "Waiting for the process $amavisd_pid to terminate\n";
+        print STDERR "Waiting for the process [$amavisd_pid] to terminate\n";
       } else {  # use stronger hammer
         print STDERR "Sending SIGKILL to amavisd[$amavisd_pid]\n";
-        kill('KILL',$amavisd_pid)
+        $kill_sig_used = 'KILL';
+        kill($kill_sig_used,$amavisd_pid)
           or warn "Can't SIGKILL amavisd[$amavisd_pid]: $!";
         $sigkill_sent = 1;
@@ -9568,6 +9574,7 @@
   };
   if ($@ ne '') { chomp($@); die "$@, can't $cmd the process\n" }
-  exit 0  if $cmd eq 'stop';
-  print STDERR "daemon terminated, waiting for the dust to settle...\n";
+  my($msg) = "Daemon [$killed_amavisd_pid] terminated by SIG$kill_sig_used";
+  if ($cmd eq 'stop') { print STDERR "$msg\n"; exit 0 }
+  print STDERR "$msg, waiting for the dust to settle...\n";
   sleep 5;  # wait for the TCP socket to be released
   print STDERR "becoming a new daemon...\n";



Mark

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
AMaViS-user mailing list
AMaViS-user@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/

Reply via email to