Daryl C. W. O'Shea wrote:
Rick Macdougall wrote:
Dallas L. Engelken wrote:
-----Original Message-----

well, the pyzor/razor plugins now (svn) use the
Mail::SpamAssassin::Timeout code, instead of
M::SA::Util->trap_sigalrm_fully

i'm not sure if that would help or not, but you'd have to be running
something newer than 3.1.3.

No, Still running 3.1.3, if it wasn't a diskless server I'd update to a more recent version but that would affect all the diskless servers, not just one to test on and I don't want to do that without testing it first.

3.1.3 has M::SA::Timeout, which will definitely work better for timing out eval blocks.


Daryl

Does this patch below look even vaguely correct ? (and of course the same loop around hash 2 etc)


--- ixhash.pm   2006-07-04 18:46:55.707706000 -0400
+++ ixhash.pm.new       2006-07-10 19:00:03.964058000 -0400
@@ -85,12 +85,6 @@
         # here we implement proper alarms, ala Pyzor, Razor2 plugins.
# keep the alarm as $oldalarm, so we dont loose the timeout-child alarm # see http://issues.apache.org/SpamAssassin/show_bug.cgi?id=3828#c123
-        my $oldalarm = 0;
- my $timeout = $permsgstatus->{main}->{conf}->{'ixhash_timeout'} || 5;
-        eval {
- Mail::SpamAssassin::Util::trap_sigalrm_fully(sub { die "ixhash
timeout reached"; });
-        $oldalarm = alarm($timeout);
-

#----------------------------------------------------------------------
-
         # Creation of hash # 1 if following conditions are met:
         # - mail contains at least 16 spaces or tabs
@@ -112,7 +106,12 @@
                 dbg ("IXHASH: Computed hash-value $digest via method 1");
                 dbg ("IXHASH: Now checking $digest.$dnsserver");
                 # Now check via DNS query
- $answer = $resolver->search($digest.'.'.$dnsserver, "A", "IN"); + my $timeout = $permsgstatus->{main}->{conf}->{'ixhash_timeout'}
|| 5;
+ my $timer = Mail::SpamAssassin::Timeout->new({ secs => $timeout
});
+               my $err = $time->run_and_catch(sub {
+ $answer = $resolver->search($digest.'.'.$dnsserver, "A","IN");
+               }
+
                 if ($answer) {
                         foreach $rr ($answer->answer) {
                                 next unless $rr->type eq "A";
@@ -120,6 +119,11 @@
                                 $hits = 1 if $rr->address;
                         }
                 }
+
+               if ($timer->timed_out()) {
+ dbg("ixhash: check timed out after $timeout seconds");
+                       return 0;
+               }
         }
         # End of computing hash #1

#---------------------------------------------------------------------

Reply via email to