You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by do...@apache.org on 2006/04/01 10:46:00 UTC

svn commit: r390624 - /spamassassin/trunk/spamd/spamd.raw

Author: dos
Date: Sat Apr  1 00:45:59 2006
New Revision: 390624

URL: http://svn.apache.org/viewcvs?rev=390624&view=rev
Log:
bug 4699: catch copy_config alarm timeouts with empty 

Modified:
    spamassassin/trunk/spamd/spamd.raw

Modified: spamassassin/trunk/spamd/spamd.raw
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/spamd/spamd.raw?rev=390624&r1=390623&r2=390624&view=diff
==============================================================================
--- spamassassin/trunk/spamd/spamd.raw (original)
+++ spamassassin/trunk/spamd/spamd.raw Sat Apr  1 00:45:59 2006
@@ -943,9 +943,13 @@
         # that can cause spamd to hang -- see bug 3828 comment 154.
         # we don't use Storable any more, but leave this in -- just
         # in case.
+	# dos: under high load an alarm may fire while $@ will contain ""
+	# which isn't very useful... workaround with $timedout counter, which
+	# is safe since it doesn't require malloc() being called, see bug 4699
         my $oldalarm = 0;
+	my $timedout = 0;
         eval {
-          local $SIG{ALRM} = sub { die "__alarm__\n" };
+          local $SIG{ALRM} = sub { $timedout++; die "__alarm__\n" };
           $oldalarm = alarm 10;
 
           while(my($k,$v) = each %msa_backup) {
@@ -973,6 +977,11 @@
             die $err;     # propagate failures
           }
         }
+	if ($timedout) {
+          warn("spamd: copy_config timeout (with empty \$@), respawning ".
+		"child process after ".($i+1)." messages");
+          exit;         # so that the master spamd can respawn
+	}
       }
       undef $current_user;