Bug 1611 - Bayes only ever expires once?
Summary: Bayes only ever expires once?
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Libraries (show other bugs)
Version: SVN Trunk (Latest Devel Version)
Hardware: Other other
: P2 critical
Target Milestone: 2.50
Assignee: Malte S. Stretz
URL:
Whiteboard:
Keywords: backport
: 1555 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-03-06 12:02 UTC by Theo Van Dinter
Modified: 2003-03-13 10:59 UTC (History)
2 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status
suggested patch for 2.50 patch None Theo Van Dinter [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Theo Van Dinter 2003-03-06 12:02:32 UTC
Unless I'm reading the code wrong, a scan() will call expiry_due() to see if an expire run needs to happen.  It looks at the ntokens entry in the database, and if runs if ntokens > min_size (which doesn't make any sense since we'd expire back to min_size, and we'd then start expiring every scan()), it'll expire.

However, ntokens only ever gets updated when an expire is done.  So an expire never actually occurs unless it's forced.

Or am I missing something?

My suggested change would be to make tok_put:

sub tok_put {
  my ($self, $tok, $ts, $th, $atime) = @_;
  $ts ||= 0;
  $th ||= 0;
  if ($ts == 0 && $th == 0) {
    delete $self->{db_toks}->{$tok};
    $self->{db_toks}->{$NTOKENS_MAGIC_TOKEN}--;
  } else {
    if ( !exists $self->{db_toks}->{$tok} ) {
      $self->{db_toks}->{$NTOKENS_MAGIC_TOKEN}++;
    }
    $self->{db_toks}->{$tok} = tok_pack ($ts, $th, $atime);
  }
}


I added the sections for $NTOKENS_MAGIC_TOKEN.   Thoughts?  I'd do up a suggested patch, but I have to head out to a doctor's appointment. :|
Comment 1 Jason Brunette 2003-03-06 12:43:35 UTC
*** Bug 1555 has been marked as a duplicate of this bug. ***
Comment 2 Jason Brunette 2003-03-06 12:44:24 UTC
I filed this as bug 1555 but no one said anything.

Marked 1555 as dup of this.
Comment 3 Theo Van Dinter 2003-03-06 13:39:30 UTC
Subject: Re:  Bayes only ever expires once?

On Thu, Mar 06, 2003 at 12:44:24PM -0800, bugzilla-daemon@hughes-family.org wrote:
> I filed this as bug 1555 but no one said anything.
> 
> Marked 1555 as dup of this.

huh!  I was looking for "bayes" in the summary, so I didn't see your bug.
Thanks for noticing this!  I see your code is much the same as mine
except you do an extra check (good thing).  I'll put it in 2.60 shortly
and put up a 2.50 patch for consideration shortly. :)

Comment 4 Antony Mawer 2003-03-06 13:43:07 UTC
Subject: Re: [SAdev]  New: Bayes only ever expires once? 


> I added the sections for $NTOKENS_MAGIC_TOKEN.   Thoughts?  I'd do up a sugge
> sted patch, but I have to head out to a doctor's appointment. :|

yes, it makes sense.  (ps: doh ;)

Comment 5 Theo Van Dinter 2003-03-06 14:37:11 UTC
Created attachment 729 [details]
suggested patch for 2.50
Comment 6 Theo Van Dinter 2003-03-06 14:40:02 UTC
reassigning to malte. :)
Comment 7 Theo Van Dinter 2003-03-13 19:59:33 UTC
committed to 2.5 branch.  closing bug.