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 2005/05/21 03:18:32 UTC
svn commit: r171177 -
/spamassassin/trunk/lib/Mail/SpamAssassin/SpamdForkScaling.pm
Author: jm
Date: Fri May 20 18:18:30 2005
New Revision: 171177
URL: http://svn.apache.org/viewcvs?rev=171177&view=rev
Log:
add more error-handling and paranoia to prefork code
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=171177&r1=171176&r2=171177&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/SpamdForkScaling.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/SpamdForkScaling.pm Fri May 20 18:18:30 2005
@@ -254,12 +254,28 @@
if (defined $kid)
{
my $sock = $self->{backchannel}->get_socket_for_child($kid);
+ if (!$sock)
+ {
+ # this should not happen, but if it does, trap it here
+ # before we attempt to call a method on an undef object
+ warn "prefork: oops! no socket for child $kid, killing";
+ delete $self->{kids}->{$kid};
+ kill 'INT' => $kid;
+
+ # retry with another child
+ return $self->order_idle_child_to_accept();
+ }
+
if (!$sock->syswrite ("A....\n"))
{
# failure to write to the child; bad news. call it dead
warn "prefork: killing rogue child $kid, failed to write: $!\n";
$self->set_child_state ($kid, PFSTATE_KILLED);
kill 'INT' => $kid;
+
+ # close the socket and remove the child from our list
+ delete $self->{kids}->{$kid};
+ $sock->close();
# retry with another child
return $self->order_idle_child_to_accept();