[Mimedefang] greylisting DB_File locking

Lucas Albers admin at cs.montana.edu
Tue Apr 27 18:27:19 EDT 2004


I used this lock and it work well for me:
Never any problems:

sub lock_db () {
    open(LOCKFILE, ">>$DBFilename.lock") or return 0;
    flock(LOCKFILE, \&LOCK_EX);
    return 1;
}

sub unlock_db () {
    flock(LOCKFILE, \&LOCK_UN);
    close(LOCKFILE);
    unlink("$DBFilename.lock");
    return 1;
}


-ray said:
>
> All,
>
> I turned on greylisting last night, based on the code posted by Steve
> Rocha (which was based on Jonas's code i think).  Things were fine until
> the db reached about 3300 records.  Then it would not accept any new keys,
> the inserts just silently fail.  I turned off greylisting and verified
> this... it appears the db is corrupt.
>
> Could this be caused by a locking issue?  Right now the lock_db function
> is just using flock before tie'ing the hash:
>
>        lock_db();
>         if (tie(%GDB,'DB_File', $DBFilename)) {
>
>
> Is this safe?  It is a moderately busy mail server, around 150k messages
> a day.  Is this too much for a dbm file?  I'd imagine i'd have 10's of
> thousands of triplets in the db.  Should i look at implementing it in
> mysql or postgres?
>
> And just for my curiousity, is there a way to repair a corrupt dbm file?
>
> ray
>
> _______________________________________________
> Visit http://www.mimedefang.org and http://www.canit.ca
> MIMEDefang mailing list
> MIMEDefang at lists.roaringpenguin.com
> http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
>


-- 
Luke Computer Science System Administrator
Security Administrator,College of Engineering
Montana State University-Bozeman,Montana



More information about the MIMEDefang mailing list