Perl and BerkleyDB

In our Mailservers (Postfix) we use a lot of policy-servers, which are custom perl servers, eg granting sender permissions to external mailservers or building live-statistics of mail throughput. However, i recently ran into some problems starting one of those which uses a berkley database backend (aka bdb via BerkleyDB and BerkeleyDB::Env with DB_INIT_MPOOL from CPAN). On manual starting, i always got “Lock table is out of available locker entries”, which could not really be the case, because the perl-policy-server was the one and only accessing this database and the server has just been setup – so no traffic, a single newborn thread. Checking with db_stat revealed that bdb really thinks, all locks are in use:

1025	Last allocated locker ID
0x7fffffff	Current maximum unused locker ID
5	Number of lock modes
1000	Maximum number of locks possible
1000	Maximum number of lockers possible
1000	Maximum number of lock objects possible
500	Number of current locks
501	Maximum number of locks at any one time
1000	Number of current lockers
1000	Maximum number of lockers at any one time
33	Number of current lock objects
34	Maximum number of lock objects at any one time
1504	Total number of locks requested
1004	Total number of locks released
0	Total number of locks upgraded
1000	Total number of locks downgraded
0	Lock requests not available due to conflicts, for which we waited
0	Lock requests not available due to conflicts, for which we did not wait
0	Number of deadlocks
0	Lock timeout value
0	Number of locks that have timed out
0	Transaction timeout value
0	Number of transactions that have timed out
712KB	The size of the lock region
0	The number of region locks that required waiting (0%)

Well, the solution was to clear the environment directory on restart, because the statistics are (of course) persistent! So i removed any “__db.*”-file in the environment directory and everything worked like a charm again.

Leave a Reply

CAPTCHA image