You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2004/12/15 23:32:27 UTC
svn commit: r112039 - /spamassassin/trunk/spamd/spamd.raw
Author: jm
Date: Wed Dec 15 14:32:26 2004
New Revision: 112039
URL: http://svn.apache.org/viewcvs?view=rev&rev=112039
Log:
bug 3828: if the copy_config() call takes over 10 seconds (ie. it's hung), the child logs a message and exits immediately, so the master can respawn a new one.
Modified:
spamassassin/trunk/spamd/spamd.raw
Modified: spamassassin/trunk/spamd/spamd.raw
Url: http://svn.apache.org/viewcvs/spamassassin/trunk/spamd/spamd.raw?view=diff&rev=112039&p1=spamassassin/trunk/spamd/spamd.raw&r1=112038&p2=spamassassin/trunk/spamd/spamd.raw&r2=112039
==============================================================================
--- spamassassin/trunk/spamd/spamd.raw (original)
+++ spamassassin/trunk/spamd/spamd.raw Wed Dec 15 14:32:26 2004
@@ -988,17 +988,40 @@
}
}
- if ($copy_config_p) {
- while(my($k,$v) = each %msa_backup) {
- $spamtest->{$k} = $v;
- }
+ if ($copy_config_p)
+ {
+ # use a timeout! There are bugs in Storable on certain platforms
+ # that can cause spamd to hang -- see bug 3828 comment 154.
+ my $oldalarm = 0;
+ eval {
+ local $SIG{ALRM} = sub { die "__alarm__\n" };
+ $oldalarm = alarm 10;
+
+ while(my($k,$v) = each %msa_backup) {
+ $spamtest->{$k} = $v;
+ }
+
+ # if we changed user, we would have also loaded up new configs
+ # (potentially), so let's restore back the saved version we
+ # had before.
+ $spamtest->copy_config(\%conf_backup, undef) ||
+ die "error returned from copy_config, no Storable module?\n";
+ alarm $oldalarm;
+ };
- # if we changed user, we would have also loaded up new configs
- # (potentially), so let's restore back the saved version we
- # had before.
- #
- $spamtest->copy_config(\%conf_backup, undef) ||
- die "error returned from copy_config, no Storable module?\n";
+ alarm $oldalarm;
+ my $err = $@;
+
+ if ($err) {
+ if ($err =~ /__alarm__/) {
+ logmsg("copy_config timeout, respawning child process after ".
+ ($i+1)." messages");
+ exit; # so that the master spamd can respawn
+
+ } else {
+ die $err; # propagate failures
+ }
+ }
}
undef $current_user;