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/05 21:46:23 UTC

svn commit: r391755 - /spamassassin/trunk/lib/Mail/SpamAssassin/SpamdForkScaling.pm

Author: dos
Date: Wed Apr  5 12:46:22 2006
New Revision: 391755

URL: http://svn.apache.org/viewcvs?rev=391755&view=rev
Log:
bug 4852: race condition in spamd pre-fork causes harmless warnings in logs, fixed

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/SpamdForkScaling.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/SpamdForkScaling.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/SpamdForkScaling.pm?rev=391755&r1=391754&r2=391755&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/SpamdForkScaling.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/SpamdForkScaling.pm Wed Apr  5 12:46:22 2006
@@ -325,9 +325,16 @@
 
   my ($sock, $kid);
   while (($kid, $sock) = each %{$self->{backchannel}->{kids}}) {
-    $self->syswrite_with_retry($sock, PF_PING_ORDER, $kid, 3) and next;
-
-    warn "prefork: write of ping failed to $kid fd=".$sock->fileno.": ".$!;
+    # if the file handle is still defined ping the child
+    # bug 4852: if not, we've run into a race condition with the child's
+    # SIGCHLD handler... try killing again just in case something else happened
+    if (defined $sock->fileno) {
+      $self->syswrite_with_retry($sock, PF_PING_ORDER, $kid, 3) and next;
+      warn "prefork: write of ping failed to $kid fd=".$sock->fileno.": ".$!;
+    } else {
+      warn "prefork: cannot ping $kid, file handle not defined, child likely ".
+	   "to still be processing SIGCHLD handler after killing itself\n";
+    }
 
     # note: this is safe according to the note in perldoc -f each; 'it is
     # always safe to delete the item most recently returned by each()'