Parent Directory | Revision Log | Patch
--- spamassassin/trunk/spamd/spamd.raw 2005/06/28 07:06:03 202142 +++ spamassassin/trunk/spamd/spamd.raw 2005/06/28 07:12:06 202143 @@ -52,6 +52,7 @@ use Errno; use Cwd (); use File::Spec 0.8; use File::Path; +use Carp (); # Check to make sure the script version and the module version matches. # If not, die here! Also, deal with unchanged VERSION macro. @@ -734,6 +735,10 @@ if ($copy_config_p) { my $got_sighup; setup_parent_sig_handlers(); +# bonus: SIGUSR2 to dump a stack trace. this is never reset +my $current_msgid = "(none)"; +$SIG{USR2} = \&backtrace_handler; + my $select_mask = ''; vec($select_mask, $server->fileno, 1) = 1; $backchannel->set_selector(\$select_mask); @@ -1224,6 +1229,7 @@ sub check { $msgid ||= "(unknown)"; $current_user ||= "(unknown)"; + $current_msgid = $msgid; # for the SIGUSR2 backtrace info("spamd: " . ($method eq 'PROCESS' ? "processing" : "checking") . " message $msgid" . ( $rmsgid ? " aka $rmsgid" : "" ) @@ -2036,6 +2042,11 @@ sub restart_handler { $got_sighup = 1; } +sub backtrace_handler { + Carp::cluck("spamd: caught SIGUSR2 - dumping backtrace. ". + "most recent message: $current_msgid\n"); +} + sub daemonize { # Pretty command line in ps $0 = join (' ', $ORIG_ARG0, @ORIG_ARGV) unless would_log("dbg");
infrastructure at apache.org | ViewVC Help |
Powered by ViewVC 1.1.26 |