You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2013/01/31 02:10:56 UTC
[Bug 6901] New: untie db first to fix "bayes db version 0 is not
able to be used, aborting!" problem
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6901
Bug ID: 6901
Summary: untie db first to fix "bayes db version 0 is not able
to be used, aborting!" problem
Product: Spamassassin
Version: 3.3.2
Hardware: PC
OS: Linux
Status: NEW
Severity: major
Priority: P2
Component: Learner
Assignee: dev@spamassassin.apache.org
Reporter: spamassassin@robm.fastmail.fm
Classification: Unclassified
For the longest time, we've been seeing intermittent bayes db corruption with
the error:
"bayes: bayes db version 0 is not able to be used, aborting!"
After a week of adding more and more debug statements and getting more and more
confused, I finally concluded it had to be something weird in DB_File. I
finally created a test case that reproduced it, which resulted in this bug.
https://rt.cpan.org/Ticket/Display.html?id=83060
I'm still calming down from my swearing session.
It seems to me the easiest solution is to add:
untie %{$self->{$db_var}};
Before any call to tie.
Annoyingly, there was code in tie_db_readonly to do this, but it's commented
out and has been since the first commit.
# untie %{$self->{$db_var}} if (tied %{$self->{$db_var}});
Adding a similar line to tie_db_writeable would be good as well.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 6901] untie db first to fix "bayes db version 0 is not able to
be used, aborting!" problem
Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6901
Matthew Elvey <sp...@matthew.elvey.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |spamassassin4@matthew.elvey
| |.com
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 6901] untie db first to fix "bayes db version 0 is not able to
be used, aborting!" problem
Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6901
Rob Mueller <sp...@robm.fastmail.fm> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |spamassassin@robm.fastmail.
| |fm
--- Comment #1 from Rob Mueller <sp...@robm.fastmail.fm> ---
I've just applied this patch to my local DBM.pm module and will see in 24 hours
how it's looking. I think this should fix it, but I'll update to confirm what I
find.
---
--- DBM.pm 2013-01-30 20:20:43.000000000 -0500
+++ /usr/share/perl5/Mail/SpamAssassin/BayesStore/DBM.pm 2013-01-30
20:21:09.000000000 -0500
@@ -175,7 +175,7 @@
my $db_var = 'db_'.$dbname;
dbg("bayes: tie-ing to DB file R/O $name");
- # untie %{$self->{$db_var}} if (tied %{$self->{$db_var}});
+ untie %{$self->{$db_var}};
if (!tie %{$self->{$db_var}},$self->DBM_MODULE, $name, O_RDONLY,
(oct($main->{conf}->{bayes_file_mode}) & 0666))
{
@@ -185,6 +185,7 @@
# be writing to it; let the R/W api deal with that case.
if ($dbname eq 'seen') {
+ untie %{$self->{$db_var}};
tie %{$self->{$db_var}},$self->DBM_MODULE, $name, O_RDWR|O_CREAT,
(oct($main->{conf}->{bayes_file_mode}) & 0666)
or goto failed_to_tie;
@@ -290,6 +291,7 @@
($self->DBM_MODULE eq 'DB_File') and
Mail::SpamAssassin::Util::avoid_db_file_locking_bug ($name);
+ untie %{$self->{$db_var}};
tie %{$self->{$db_var}},$self->DBM_MODULE, $name, O_RDWR|O_CREAT,
(oct($main->{conf}->{bayes_file_mode}) & 0666)
or goto failed_to_tie;
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 6901] untie db first to fix "bayes db version 0 is not able to
be used, aborting!" problem
Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6901
--- Comment #4 from Rob Mueller <sp...@robm.fastmail.fm> ---
FYI I've been running with the patch for a few weeks now, and all the error
messages are gone, so this definitely fixed the problem for us.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 6901] untie db first to fix "bayes db version 0 is not able to
be used, aborting!" problem
Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6901
Mark Martinec <Ma...@ijs.si> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from Mark Martinec <Ma...@ijs.si> ---
Ok, let's consider this closed, thanks for investigating
and for reporting the tie issue to CPAN.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 6901] untie db first to fix "bayes db version 0 is not able to
be used, aborting!" problem
Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6901
--- Comment #3 from Mark Martinec <Ma...@ijs.si> ---
Created attachment 5135
--> https://issues.apache.org/SpamAssassin/attachment.cgi?id=5135&action=edit
comitted diff
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 6901] untie db first to fix "bayes db version 0 is not able to
be used, aborting!" problem
Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6901
Mark Martinec <Ma...@ijs.si> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|Undefined |3.4.0
--- Comment #2 from Mark Martinec <Ma...@ijs.si> ---
> I've just applied this patch to my local DBM.pm module and will see in 24
> hours how it's looking. I think this should fix it, but I'll update to
> confirm what I find.
According to perl documentation untie has no effect if the variable
is not tied, so your solution looks harmless, and if it avoids
the bug so much the better. Thanks!
trunk:
Bug 6901: untie db first to fix "bayes db version 0 is not able
to be used, aborting!" problem
Sending lib/Mail/SpamAssassin/BayesStore/DBM.pm
Committed revision 1450914.
--
You are receiving this mail because:
You are the assignee for the bug.