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/12/11 20:45:51 UTC

svn commit: r485842 - /spamassassin/branches/3.1/spamd/spamd.raw

Author: dos
Date: Mon Dec 11 11:45:50 2006
New Revision: 485842

URL: http://svn.apache.org/viewvc?view=rev&rev=485842
Log:
bug 4304: in some setups, eg where a plugin implements 'spamd_child_init' with a long-running task, it's possible for child spamd processes to take too long to exit when the parent spamd is killed with SIGINT or SIGTERM.  if the caller then starts a new spamd immediately, it will die with 'address already in use', since the old children are still running.  Fix this race by unblocking the signals as soon as possible in child spamds after they are forked, and before calling the plugin hook; also add test cases

Modified:
    spamassassin/branches/3.1/spamd/spamd.raw

Modified: spamassassin/branches/3.1/spamd/spamd.raw
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.1/spamd/spamd.raw?view=diff&rev=485842&r1=485841&r2=485842
==============================================================================
--- spamassassin/branches/3.1/spamd/spamd.raw (original)
+++ spamassassin/branches/3.1/spamd/spamd.raw Mon Dec 11 11:45:50 2006
@@ -846,6 +846,13 @@
   else {
     ## CHILD
 
+    # Reset signal handling to default settings.
+    setup_child_sig_handlers();
+
+    # unblock signals
+    sigprocmask( POSIX::SIG_UNBLOCK(), $sigset )
+      or die "spamd: cannot unblock SIGINT/SIGCHLD for fork: $!\n";
+
     $spamtest->call_plugins("spamd_child_init");
 
     # support non-root use
@@ -884,13 +891,6 @@
         die "spamd: setuid to uid $uuid failed\n";
       }
     }
-
-    # Reset signal handling to default settings.
-    setup_child_sig_handlers();
-
-    # unblock signals
-    sigprocmask( POSIX::SIG_UNBLOCK(), $sigset )
-      or die "spamd: cannot unblock SIGINT/SIGCHLD for fork: $!\n";
 
     # set process name where supported
     # this will help make it clear via process listing which is child/parent