Processing Database Corruption

Christiaan den Besten chris at
Wed Oct 14 14:15:47 IST 2009

Hi !

We seem to be hitting a 'bug' (or bad programming on my side) when using the Processing database. Machines scanning ± 600k msg/day get a 
corrupted .db once every few days.

We suspect this started when we introduced a monitoring-check to see if the number of messages in the database is not exceeding our limit. To 
check this we use :


sub db_dump_count {
         my $dbh;
         my $sth;
         my $row;

         my $dbh = DBI->connect("dbi:SQLite:dbname=/opt/exim/spool/MailScanner/incoming/Processing.db","","",{PrintError => 0, RaiseError => 0})
or die "Could not find Processing.db";

         $sth = $dbh -> prepare ("SELECT COUNT(*) AS Count FROM processing") or return 0;
         $sth -> execute ();
         if ($row = $sth -> fetchrow_hashref() ) {
                 return $$row{"Count"};
         $sth -> finish ();

         return 0;


Is it possible that opening the same database twice is not possible using sqllite ?

Version MailScanner : 4.77.10
Version SQLLite3 :
     - 1.601 DBI,
     - 1.14 DBD::SQLite,
     - 3.4.2-2 sqlite3

I was thinking on writing a patch to do the same, but use memcache instead to resolve this ....

Christiaan den Besten

More information about the MailScanner mailing list