locking w/ whitelisting

Barry Gould BarryGould at PennySaverUSA.net
Wed Mar 26 02:52:28 CET 2003


Hi David,

I'm not really worried about corruption (I understand bogofilter locks well.)

Actually, I was worried that procmail might launch both bogofilter threads 
at once, since I'm using the copy (c) directive in procmail to make a copy 
and process it.
In which case, the bogofilter -n might not be done before the other 
bogofilter started, causing the whitelisting to be ignored _for the current 
message_.
i.e., a possible false positive.

Maybe I'm wrong? (does procmail parallelize or run everything serially? 
IIRC, it will parallelize when it doesn't need to wait for the result of 
something.)

Thanks,
Barry

At 05:47 PM 3/25/2003, David Relson wrote:
>At 07:57 PM 3/25/03, Barry Gould wrote:
>
>>Hi,
>>
>>In my procmailrc, I have a whitelist, which does makes a copy, and runs 
>>it through bogofilter -n
>>(recipe below)
>>
>>Subsequently, all messages are run through bogofilter -e -p
>>
>>I'm concerned that the whitelist may not work on the current message if 
>>both tasks run at the same time; i.e. the -e -p may not be affected by 
>>the -n for the current message.
>>
>>Question: should I do some sort of locking so that the bogofilter -n 
>>finishes before the bogofilter -e -p? What would be the best way to 
>>achieve this?
>>
>>Thanks,
>>Barry
>
>Barry,
>
>Let me see if I under the scenario that you're worrying about.  A 
>whitelist message arrives, which causes bogofilter to update its non-spam 
>wordlist.  While this is happening, a second (non-whitelist) message 
>arrives.  You're wondering whether there will be problems with two copies 
>of bogofilter running.  Is this your scenario?
>
>Bogofilter locks the wordlists to prevent corruption.  If bogofilter finds 
>a wordlist already locked, it delays a while and tries again.  (The code 
>for this is in file src/wordlists.c, functions open_wordlists() and 
>rand_sleep()).
>
>With this lock/retry code you should be safe.
>
>David





More information about the Bogofilter mailing list