database is locked(5) at dbdimp.c line 402

Alvaro Marín alvaro at hostalia.com
Thu Oct 23 15:04:55 IST 2008


Hello,

I'm getting this error continuosly when the server's load is high:

MailScanner[29045]: database is locked(5) at dbdimp.c line 402

and the message scanning slows a lot.

I see that:

# grep timeout .cpan/build/DBD-SQLite-1.14-hR9dHa/dbdimp.h  -i
/* 30 second timeout by default */
#define SQL_TIMEOUT 30000

the timeout is 30secs by default in SQLite, perhaps too high (I prefer
scan the message again instead of wait 30secs).

So I've modified MailScanner's SA.pm and added:

          $MailScanner::SA::cachedbh->func( "2000", 'busy_timeout');

to set it to 2 seconds, after the connection to the cache db:

          $MailScanner::SA::cachedbh = DBI->connect(

"dbi:SQLite:$MailScanner::SA::cachefilename",
                                  "","",{PrintError=>0,InactiveDestroy=>1});


I've tested it and it seems that works fine; is this a safe way to do
this? Perhaps recompile SQLite changing that value is better?

Regards,

-- 
Alvaro Marín Illera
Hostalia Internet
www.hostalia.com



More information about the MailScanner mailing list