[spambayes-dev] race conditions in imap filtering?

Alon arohter at nolar.com
Tue Sep 9 15:36:56 EDT 2003


I use imapfilter to classify and train my mail via cronjobs.  I run 
classify every 15 min, and training once day.  To solve the classifying vs. 
training issue, I wrote a wrapper script that creates a 
/var/lock/spambayes.lck before execution and removes it when done.  That 
way, if a classification job starts while training is in progress, it'll 
pause until it sees the spambayes.lck is gone.  This works brilliantly on 
my linux system, but might be a wee bit of trouble for Windows users. 
Perhaps you should think about incorporating a locking mechanism into 
sb_imapfilter (or all relevant scripts) itself?

aLoN


> The other day I started reading my mail from an IMAP server, so I started
> using sb_imapfilter.py to filter my mail.  Looking at the code I have to
> wonder how safe it is from corrupting my database and my e-mail.
>
> The problem is this.  There is an option -c to classify mail on the IMAP
> server, and there is an option -l <minutes> to loop and classify every
> <minutes>.  When the filter starts up it opens the database, and it never
> closes it, and it never re-reads it.  If I want to train on some messages
> I could do that while the imapfilter is still running, but then it won't
> pick up the new ham and spam count although I suppose it will pick up the
> new word counts--not everything is in-core, and so the results will be
> off.






More information about the spambayes-dev mailing list