(no subject)

Matthias Andree matthias.andree at gmx.de
Tue Nov 9 14:11:48 CET 2004


"Robin Bowes" <robin-lists at robinbowes.com> writes:

> Since upgrading to 0.93, I'm getting the following error when running
> bogofilter from a cronjob to process spam:
>
>   Lock table is out of available object entries
>   Can't open file 'wordlist.db' in directory
>   '/home/vpopmail/domains/robinbowes.com/robin/.bogofilter'.
>   error #12 - Cannot allocate memory.
>
> Any idea what causes this?

BTW, 0.93.0 has a bug in that it cannot automatically run recovery
(hence the name "current" release, as opposed to "stable"), running
bogoutil -f '/home/vpopmail/domains/robinbowes.com/robin/.bogofilter' is
advised after each error. This will be fixed in 0.93.1, you can also
apply this patch, recompile, reinstall, and then run the bogoutil -f
command as shown above.

--- src/datastore_db.c	2 Nov 2004 02:29:14 -0000	1.114
+++ src/datastore_db.c	8 Nov 2004 22:06:14 -0000	1.115
@@ -1,4 +1,4 @@
-/* $Id: datastore_db.c,v 1.114 2004/11/02 02:29:14 m-a Exp $ */
+/* $Id: datastore_db.c,v 1.115 2004/11/08 22:06:14 m-a Exp $ */
 
 /*****************************************************************************
 
@@ -322,7 +322,7 @@
     char *t;
 
     dbh_t *handle = NULL;
-    uint32_t opt_flags = 0;
+    uint32_t opt_flags = (open_mode == DS_READ) ? DB_RDONLY : 0;
 
     assert(init);
 
@@ -352,6 +352,8 @@
 	else
 	    t = handle->name;
 
+	handle->open_mode = open_mode;
+
 retry_db_open:
 	handle->created = false;
 	if ((ret = DB_OPEN(dbp, t, NULL, dbtype, opt_flags, 0664)) != 0
@@ -988,28 +990,37 @@
     const u_int32_t numlocks = 16384;
     const u_int32_t numobjs = 16384;
 
+    /* open lock file, needed to detect previous crashes */
     if (init_dbl(bogohome))
+	exit(EX_ERROR);
 
-    if (needs_recovery()) {
-	db_recover(0, 0);
-    }
+    /* run recovery if needed */
+    if (needs_recovery())
+	db_recover(0, 0); /* DO NOT set force flag here, may cause
+			     multiple recovery! */
 
+    /* set (or demote to) shared/read lock for regular operation */
     db_try_glock(F_RDLCK, F_SETLKW);
 
+    /* set our cell lock in the crash detector */
     if (set_lock()) {
 	exit(EX_ERROR);
     }
 
+    /* initialize */
     return db_xinit(numlocks, numobjs, /* flags */ 0);
 }
 
 int db_recover(int catastrophic, int force) {
     int ret;
 
+    /* set exclusive/write lock for recovery */
     while((force || needs_recovery())
 	    && (db_try_glock(F_WRLCK, F_SETLKW) <= 0))
 	rand_sleep(10000,1000000);
 
+    /* ok, when we have the lock, a concurrent process may have
+     * proceeded with recovery */
     if (!(force || needs_recovery()))
 	return 0;
 


-- 
Matthias Andree



More information about the Bogofilter mailing list