You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by si...@apache.org on 2004/05/31 01:50:01 UTC
svn commit: rev 20664 - in incubator/spamassassin/trunk: spamd t
Author: sidney
Date: Sun May 30 16:50:00 2004
New Revision: 20664
Modified:
incubator/spamassassin/trunk/spamd/spamd.raw
incubator/spamassassin/trunk/t/SATest.pm
Log:
bug #3443: fix race conditions that left spamd zombies durin make test
Modified: incubator/spamassassin/trunk/spamd/spamd.raw
==============================================================================
--- incubator/spamassassin/trunk/spamd/spamd.raw (original)
+++ incubator/spamassassin/trunk/spamd/spamd.raw Sun May 30 16:50:00 2004
@@ -702,17 +702,6 @@
$opt{'daemonize'} and daemonize();
-# Make the pidfile ...
-if (defined $opt{'pidfile'}) {
- if (open PIDF, ">$opt{'pidfile'}") {
- print PIDF "$$\n";
- close PIDF;
- }
- else {
- warn "Can't write to PID file: $!\n";
- }
-}
-
# should be done post-daemonize such that any files created by this
# process are written with the right ownership and everything.
preload_modules_with_tmp_homedir();
@@ -740,13 +729,11 @@
my $got_sighup;
$SIG{HUP} = \&restart_handler;
-# now allow waiting processes to connect, if they're watching the log.
-# The test suite does this!
-
+# log server started, but processes watching the log to wait for connect
+# should wait until they see the pid, after signal handlers are in place
if ( $opt{'debug'} ) {
warn "server started on $listeninfo (running version "
. Mail::SpamAssassin::Version() . ")\n";
- warn "server pid: $$\n";
}
logmsg( "server started on $listeninfo (running version "
@@ -761,6 +748,24 @@
$SIG{CHLD} = \&child_handler;
$SIG{INT} = \&kill_handler;
$SIG{TERM} = \&kill_handler;
+
+# Make the pidfile ...
+if (defined $opt{'pidfile'}) {
+ if (open PIDF, ">$opt{'pidfile'}") {
+ print PIDF "$$\n";
+ close PIDF;
+ }
+ else {
+ warn "Can't write to PID file: $!\n";
+ }
+}
+
+# now allow waiting processes to connect, if they're watching the log.
+# The test suite does this!
+
+if ( $opt{'debug'} ) {
+ warn "server pid: $$\n";
+}
while (1) {
sleep; # wait for a signal (ie: child's death)
Modified: incubator/spamassassin/trunk/t/SATest.pm
==============================================================================
--- incubator/spamassassin/trunk/t/SATest.pm (original)
+++ incubator/spamassassin/trunk/t/SATest.pm Sun May 30 16:50:00 2004
@@ -361,6 +361,7 @@
$spamd_extra_args,
qq{&},
);
+ unlink ($spamd_stdout, $spamd_stderr, $spamd_stdlog);
print ("\t${spamd_cmd}\n");
system ($spamd_cmd);