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 2008/01/31 13:04:34 UTC
svn commit: r617111 - in /spamassassin/trunk/lib/Mail/SpamAssassin:
BayesStore/DBM.pm DBBasedAddrList.pm
Author: jm
Date: Thu Jan 31 04:04:34 2008
New Revision: 617111
URL: http://svn.apache.org/viewvc?rev=617111&view=rev
Log:
revert use of Timeout objects around the DB_File calls, it doesn't help with bug 5731 it seems
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/DBM.pm
spamassassin/trunk/lib/Mail/SpamAssassin/DBBasedAddrList.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/DBM.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/DBM.pm?rev=617111&r1=617110&r2=617111&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/DBM.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/BayesStore/DBM.pm Thu Jan 31 04:04:34 2008
@@ -27,7 +27,6 @@
use Mail::SpamAssassin::Util qw(untaint_var);
use Mail::SpamAssassin::BayesStore;
use Mail::SpamAssassin::Logger;
-use Mail::SpamAssassin::Timeout;
use Digest::SHA1 qw(sha1);
use File::Basename;
use File::Spec;
@@ -170,41 +169,23 @@
my $db_var = 'db_'.$dbname;
dbg("bayes: tie-ing to DB file R/O $name");
- # bug 5731: something in DB_File appears to hang on tie() on gutsy
- my $err;
- dbg("starting tie timeout at ".(scalar localtime time));
- my $timer = Mail::SpamAssassin::Timeout->new({ secs => 30 });
- $timer->run_and_catch(sub {
-
- # untie %{$self->{$db_var}} if (tied %{$self->{$db_var}});
- if (!tie %{$self->{$db_var}},$self->DBM_MODULE, $name, O_RDONLY,
- (oct($main->{conf}->{bayes_file_mode}) & 0666))
- {
- # bug 2975: it's acceptable for the db_seen to not be present,
- # to allow it to be recycled. if that's the case, just create
- # a new, empty one. we don't need to lock it, since we won't
- # be writing to it; let the R/W api deal with that case.
-
- if ($dbname eq 'seen') {
- tie %{$self->{$db_var}},$self->DBM_MODULE, $name, O_RDWR|O_CREAT,
- (oct($main->{conf}->{bayes_file_mode}) & 0666)
- or $err++;
- }
- else {
- $err++;
- }
+ # untie %{$self->{$db_var}} if (tied %{$self->{$db_var}});
+ if (!tie %{$self->{$db_var}},$self->DBM_MODULE, $name, O_RDONLY,
+ (oct($main->{conf}->{bayes_file_mode}) & 0666))
+ {
+ # bug 2975: it's acceptable for the db_seen to not be present,
+ # to allow it to be recycled. if that's the case, just create
+ # a new, empty one. we don't need to lock it, since we won't
+ # be writing to it; let the R/W api deal with that case.
+
+ if ($dbname eq 'seen') {
+ tie %{$self->{$db_var}},$self->DBM_MODULE, $name, O_RDWR|O_CREAT,
+ (oct($main->{conf}->{bayes_file_mode}) & 0666)
+ or goto failed_to_tie;
+ }
+ else {
+ goto failed_to_tie;
}
-
- dbg("tie returned: ".(scalar localtime time));
- });
- dbg("timer returned: ".(scalar localtime time));
-
- if ($timer->timed_out()) {
- warn "bayes: DB_File tie() call timed out after 30 seconds";
- goto failed_to_tie;
- }
- if ($err) {
- goto failed_to_tie;
}
}
@@ -300,30 +281,12 @@
my $db_var = 'db_'.$dbname;
dbg("bayes: tie-ing to DB file R/W $name");
- # bug 5731: something in DB_File appears to hang on tie() on gutsy
- my $err;
- dbg("starting tie timeout at ".(scalar localtime time));
- my $timer = Mail::SpamAssassin::Timeout->new({ secs => 30 });
- $timer->run_and_catch(sub {
-
- ($self->DBM_MODULE eq 'DB_File') and
- Mail::SpamAssassin::Util::avoid_db_file_locking_bug ($name);
-
- tie %{$self->{$db_var}},$self->DBM_MODULE, $name, O_RDWR|O_CREAT,
- (oct($main->{conf}->{bayes_file_mode}) & 0666)
- or $err++;
-
- dbg("tie returned: ".(scalar localtime time));
- });
- dbg("timer returned: ".(scalar localtime time));
-
- if ($timer->timed_out()) {
- warn "bayes: DB_File tie() call timed out after 30 seconds";
- goto failed_to_tie;
- }
- if ($err) {
- goto failed_to_tie;
- }
+ ($self->DBM_MODULE eq 'DB_File') and
+ Mail::SpamAssassin::Util::avoid_db_file_locking_bug ($name);
+
+ tie %{$self->{$db_var}},$self->DBM_MODULE, $name, O_RDWR|O_CREAT,
+ (oct($main->{conf}->{bayes_file_mode}) & 0666)
+ or goto failed_to_tie;
}
umask $umask;
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/DBBasedAddrList.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/DBBasedAddrList.pm?rev=617111&r1=617110&r2=617111&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/DBBasedAddrList.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/DBBasedAddrList.pm Thu Jan 31 04:04:34 2008
@@ -26,7 +26,6 @@
use Mail::SpamAssassin::PersistentAddrList;
use Mail::SpamAssassin::Util;
use Mail::SpamAssassin::Logger;
-use Mail::SpamAssassin::Timeout;
our @ISA = qw(Mail::SpamAssassin::PersistentAddrList);
@@ -80,30 +79,13 @@
dbg("auto-whitelist: tie-ing to DB file of type $dbm_module $mod1 in $path");
- # bug 5731: something in DB_File appears to hang on tie() on gutsy
- my $err;
- my $tied;
- dbg("starting tie timeout at ".(scalar localtime time));
- my $timer = Mail::SpamAssassin::Timeout->new({ secs => 30 });
- $timer->run_and_catch(sub {
-
- ($self->{is_locked} && $dbm_module eq 'DB_File') and
- Mail::SpamAssassin::Util::avoid_db_file_locking_bug ($path);
-
- $tied = tie %{ $self->{accum} }, $dbm_module, $path, $mod2,
- oct($main->{conf}->{auto_whitelist_file_mode});
- $err = $!;
-
- dbg("tie returned: ".(scalar localtime time));
- });
- dbg("timer returned: ".(scalar localtime time));
-
- if ($timer->timed_out() || !$tied) {
- if ($timer->timed_out()) {
- warn "auto-whitelist: DB_File tie() call timed out after 30 seconds";
- $err = "timed out";
- }
+ ($self->{is_locked} && $dbm_module eq 'DB_File') and
+ Mail::SpamAssassin::Util::avoid_db_file_locking_bug ($path);
+ if (! tie %{ $self->{accum} }, $dbm_module, $path, $mod2,
+ oct($main->{conf}->{auto_whitelist_file_mode}) )
+ {
+ my $err = $!; # might get overwritten later
if ($self->{is_locked}) {
$self->{main}->{locker}->safe_unlock($self->{locked_file});
$self->{is_locked} = 0;