Bug 2827 - [review] SA fails with 'Argument "" isn't numeric' runtime error
Summary: [review] SA fails with 'Argument "" isn't numeric' runtime error
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Learner (show other bugs)
Version: unspecified
Hardware: Other other
: P5 normal
Target Milestone: 2.62
Assignee: Theo Van Dinter
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-10 14:46 UTC by Gary Funck
Modified: 2004-03-08 23:05 UTC (History)
1 user (show)



Attachment Type Modified Status Actions Submitter/CLA Status
suggested patch patch None Theo Van Dinter [HasCLA]
Small spam corpus for testing application/x-gzip None Ben Mehling [NoCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Gary Funck 2003-12-10 14:46:22 UTC
Version 2.61 (note - Bugtraq doesn't have 2.61 yet as a choice)

With Bayes enabled, Spamassassin generates a long sequences of diagnostic 
messages of the form:

Argument "" isn't numeric in numeric lt (<) 
at /usr/lib/perl5/site_perl/5.8.0/Mail/SpamAssassin/BayesStore.pm line 1248.

(I was going to link to the SA Talk thread where this was discussed, but it 
looks like Source Forge has begun archiving the month of December. Either that 
or it isn't archiving any more).

----

In a subsequent exchange on SA Talk Theo wrote:

On Wed, Dec 10, 2003 at 01:44:17PM -0800, Gary Funck wrote:
> Follow-up, adding a check to see if $oldmagic is "" made the complaints
> go away:
> 
>    1248     my $oldmagic =
> $self->{db_toks}->{$OLDEST_TOKEN_AGE_MAGIC_TOKEN};
>    1249     $oldmagic = 0 if (defined($oldmagic) && $oldmagic eq "");
>    1250     if (!defined ($oldmagic) || $atime < $oldmagic) {
>    1251       $self->{db_toks}->{$OLDEST_TOKEN_AGE_MAGIC_TOKEN} = $atime;
>    1252     }
> 
> this can be recoded more succinctly, I'm sure.

FYI: you changed the logic of the code there.  if there is no oldest
token atime (ie: this is the first token to be learned), it should set
the value to the atime.  you've now forced oldest to be 0 until the
first expire occurs and fixes it.

the !defined bit is supposed to catch when there is no oldest token, but
apparently instead of undef, it sometimes comes back as "" (boo DB_File!)
Comment 1 Theo Van Dinter 2003-12-10 15:17:06 UTC
aiming at 2.62
Comment 2 Theo Van Dinter 2003-12-26 22:30:55 UTC
Created attachment 1639 [details]
suggested patch

I thought this may be a more widespread issue, but it turns out that the
warning that appears specifies the only line I could find that had an issue.

I simply added a check for "$oldest eq ''" in the if statement right after the
defined check.	Simple enough. :)
Comment 3 Theo Van Dinter 2003-12-26 22:31:55 UTC
setting to review status.

committed patch to SVN head.
Comment 4 Vadim Zaliva 2003-12-28 00:38:04 UTC
I am having similar problem, but suggested patch does not solve it.
Error message I have:

Argument "\007027319M-i)M-m?" isn't numeric in numeric lt (<) at
/usr/lib/perl5/site_perl/5.6.1/Mail/SpamAssassin/BayesStore.pm line 1249.
Argument "\007027319M-i)M-m?" isn't numeric in numeric lt (<) at
/usr/lib/perl5/site_perl/5.6.1/Mail/SpamAssassin/BayesStore.pm line 1249.
Argument "\007027319M-i)M-m?" isn't numeric in numeric lt (<) at
/usr/lib/perl5/site_perl/5.6.1/Mail/SpamAssassin/BayesStore.pm line 1249.
...

Comment 5 Theo Van Dinter 2003-12-28 09:02:25 UTC
Subject: Re:  [review] SA fails with 'Argument "" isn't numeric' runtime error

On Sun, Dec 28, 2003 at 01:33:16AM -0800, bugzilla-daemon@bugzilla.spamassassin.org wrote:
> I am having similar problem, but suggested patch does not solve it.
> Error message I have:

Similar error but very different root cause.

> Argument "\007027319M-i)M-m?" isn't numeric in numeric lt (<) at
> /usr/lib/perl5/site_perl/5.6.1/Mail/SpamAssassin/BayesStore.pm line 1249.
> Argument "\007027319M-i)M-m?" isn't numeric in numeric lt (<) at
> /usr/lib/perl5/site_perl/5.6.1/Mail/SpamAssassin/BayesStore.pm line 1249.
> Argument "\007027319M-i)M-m?" isn't numeric in numeric lt (<) at
> /usr/lib/perl5/site_perl/5.6.1/Mail/SpamAssassin/BayesStore.pm line 1249.
> ...

This looks like you have some form of DB corruption.  In this case, it
looks like some of the magic token data (stored as a string) got mangled with
actual token data (stored in a packed binary form).

Comment 6 Malte S. Stretz 2003-12-31 07:58:23 UTC
+1 for 1639 
Comment 7 Theo Van Dinter 2004-01-05 08:22:32 UTC
committed to 2.62 svn.
Comment 8 Ben Mehling 2004-03-08 11:47:50 UTC
Installed fresh copy of 2.63 today.  A 'make test' returns success (skipping the
razor section).  I continue to get this error (was getting it back in 2.60) when
trying to sa-learn a spam box:

user@host% /pkg/spamassassin-2.63/bin/sa-learn --spam --mbox mail/Spam
Argument "" isn't numeric in numeric lt (<) at
/pkg/spamassassin-2.63/lib/site_perl/5.6.1/Mail/SpamAssassin/BayesStore.pm line
1267.
Argument "" isn't numeric in numeric lt (<) at
/pkg/spamassassin-2.63/lib/site_perl/5.6.1/Mail/SpamAssassin/BayesStore.pm line
1267.
[ ...repeat for hundreds of lines... ]

It does look like the patch attached here is in place if I look at line 1267 in
SpamAssassin/BayesStore.pm.  I can't find a newer, open bug in bugzilla.  

I can provide more specifics or my spam corpus if desired.  Thank you.  
Comment 9 Theo Van Dinter 2004-03-08 12:23:13 UTC
Subject: Re:  [review] SA fails with 'Argument "" isn't numeric' runtime error

On Mon, Mar 08, 2004 at 11:47:51AM -0800, bugzilla-daemon@bugzilla.spamassassin.org wrote:
> I can provide more specifics or my spam corpus if desired.  Thank you.  

Is it repeatable with the mail in question?  If so, attach it to the ticket.

Comment 10 Ben Mehling 2004-03-09 08:04:40 UTC
Created attachment 1825 [details]
Small spam corpus for testing
Comment 11 Ben Mehling 2004-03-09 08:05:52 UTC
I snipped out ~100 messages from my 100+MB Spam corpus.  I tested and the
attached (mbox) file definitely throws the error:

[ ... snip hundreds of lines ... ]
Argument "" isn't numeric in numeric lt (<) at
/pkg/spamassassin-2.63/lib/site_perl/5.6.1/Mail/SpamAssassin/BayesStore.pm line
1267.
Learned from 1 message(s) (104 message(s) examined).

However, once learned, the errors wouldn't show up, so you'll have to clear the
bayes DBs to test multiple times:

user@host% /pkg/spamassassin-2.63/bin/sa-learn --spam --mbox Spam_example  
Learned from 0 message(s) (104 message(s) examined).

Thanks for your help, Ben
Comment 12 Theo Van Dinter 2004-03-09 09:14:01 UTC
Subject: Re:  [review] SA fails with 'Argument "" isn't numeric' runtime error

On Tue, Mar 09, 2004 at 08:05:53AM -0800, bugzilla-daemon@bugzilla.spamassassin.org wrote:
> I snipped out ~100 messages from my 100+MB Spam corpus.  I tested and the
> attached (mbox) file definitely throws the error:

Excellent!

> However, once learned, the errors wouldn't show up, so you'll have to clear the
> bayes DBs to test multiple times:
> 
> user@host% /pkg/spamassassin-2.63/bin/sa-learn --spam --mbox Spam_example  
> Learned from 0 message(s) (104 message(s) examined).

$ wget -O 4 'http://bugzilla.spamassassin.org/attachment.cgi?id=1825&action=view'

With 2.63:
$ ls -la SA/spamassassin-2.60/masses/spamassassin/bayes*
ls: No match.
$ sa-learn-260 --spam --mbox --showdots 4
........................................................................................................
Learned from 104 message(s) (104 message(s) examined).

With 3.0:
$ ls -la SA/spamassassin-head/masses/spamassassin/bayes*
ls: No match.
$ sa-learn-cvs --mbox --spam --showdots 4
........................................................................................................
Learned from 104 message(s) (104 message(s) examined).


The only configuration involved is:

# for 3.0, it's head instead of 2.60 ...
bayes_path /home/felicity/SA/spamassassin-2.60/masses/spamassassin/bayes
use_razor2 0
bayes_auto_learn 0


So...  It's looking like something on your system unfortunately. :(

FYI: The line of code in SA has a check for oldmagic being "", so the
only other variable in there that could be that is $atime, which is
guaranteed to be set by the time the line in question gets run.