spamassassin-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzilla-dae...@bugzilla.spamassassin.org
Subject [Bug 3743] Spamd not cleaning up defunct processes
Date Fri, 03 Sep 2004 00:53:04 GMT
http://bugzilla.spamassassin.org/show_bug.cgi?id=3743





------- Additional Comments From shjorth@telstra.com  2004-09-02 17:53 -------
Hi Theo,

We suspect the problem has to do with a SIGCHLD being received whilst the spamd
process is already in the wait state cleaning up another SIGCHLD signal; hence
the second SIGCHLD is missed. We have made the following changes to use the
waitpid call instead which will reap all children that need a cleanup. We are
currently testing the change and will report back if it fixes the problem.

--- spamd       2004-09-03 10:14:27.000000000 +1000
+++ spamd.old   2004-08-30 13:48:02.000000000 +1000
@@ -1745,11 +1745,9 @@
 sub child_handler {
   my ($sig) = @_;
   $SIG{CHLD} = \&child_handler;    # reset as necessary
-  logmsg("server hit by SIG$sig");
-  while((my $pid = waitpid(-1, &WNOHANG)) > 0) {  # reap the child
-    delete $children{$pid};                       # remove the child out of the
pool
-    logmsg("  cleaned up child pid $pid");
-  }
+  my $pid = wait;                  # reap the child
+  delete $children{$pid};          # remove the child out of the pool
+  logmsg("server hit by SIG$sig, pid $pid");
 }

 sub restart_handler {
@@ -1759,7 +1757,7 @@
   $SIG{CHLD} = 'DEFAULT';    # we're going to kill our children
   foreach (keys %children) {
     kill 'INT' => $_;
-    my $pid = waitpid($_, 0);
+    my $pid = wait;
     logmsg("child $pid killed successfully");
   }
   %children = ();



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Mime
View raw message