[PATCH] database trouble in 0.94.0 (was: Excessive memory usage: bug?)

Matthias Andree matthias.andree at gmx.de
Thu Mar 17 00:47:04 CET 2005


JUANVAQUEROPONC <JUANVAQUEROPONC at terra.es> writes:

> David Relson wrote:
>> On Wed, 16 Mar 2005 08:52:21 GMT JUANVAQUEROPONC wrote:
>> > I did:
>> > formail <spam.mbx -s bogofilter -s
>> > and everything went OK. Then I did:
>> > for i in ~/Mail/*; do formail <"$i" -s bogofilter -n; done
>> > and started to get (lots of):
>> > bogofilter: (db) DB->get(TXN=0,  'news' ), err: DB_RUNRECOVERY: Fatal error, run database recovery
>> > and after a while bogofilter process hung and I had to kill it.
>> > 
>> > Does anyone have this problem?
>> 
>> Sounds like a problem with transactions :-<
>
> Not probably since I'm using Debian unstable bogofilter_0.94.0-1 on x86
> and it has transactions desactivated by default, hasn't it?

That depends. If you're running bogofilter in a directory that you have
used a transaction-capable version in, 0.94.0 will continue to use
transactions unless it was configured with --disable-transactions, which
I doubt. __db.* or log.* files will trigger transactional mode, for
maximum compatibility with the existing setup.

Anyways, I made two bug fixes Monday morning that might cause trouble in
some circumstances, the dbx_common_close() bug strikes when automatic
log purging is enabled in transactional mode (default!) - so that means
that if you run several instances of bogofilter at the same time,
chances are that one quits uncleanly, causing other processes to exit.

        Bugfix: if running recovery automatically, don't die right away
        when setting the lock.

        Bugfix: for let dbx_common_close clear the process table lock to
        avoid recovery after simple bogoutil operations.

The patch for 0.94.0 is:

--- ./src/datastore_db_trans.c.bak	2005-03-05 22:08:11.000000000 +0100
+++ ./src/datastore_db_trans.c	2005-03-17 00:42:16.000000000 +0100
@@ -478,10 +478,15 @@
 	exit(EX_ERROR);
 
     /* run recovery if needed */
-    if (needs_recovery())
+    if (needs_recovery()) {
 	dbe_recover(directory, false, false); /* DO NOT set force flag here, may cause
 						 multiple recovery! */
 
+	/* reinitialize */
+	if (init_dbl(directory->dirname))
+	    exit(EX_ERROR);
+    }
+
     /* set (or demote to) shared/read lock for regular operation */
     db_try_glock(directory, F_RDLCK, F_SETLKW);
 
@@ -686,6 +691,7 @@
 	exit(EX_ERROR);
     }
 
+    clear_lock();
     db_try_glock(directory, F_UNLCK, F_SETLKW); /* release lock */
     return EX_OK;
 }

-- 
Matthias Andree
_______________________________________________
Bogofilter mailing list
Bogofilter at bogofilter.org
http://www.bogofilter.org/mailman/listinfo/bogofilter



More information about the Bogofilter mailing list