Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

CHI / BerkeleyDB Locker Entries

by mobiusinversion (Beadle)
on Jun 18, 2012 at 20:11 UTC ( [id://976889]=perlquestion: print w/replies, xml ) Need Help??

mobiusinversion has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I have a caching daemon and several apache mpm_worker processes which connect to a BDB via CHI. These proceses are designed to run for long periods of time without restart as part of a larger web site. After these processes have been running for two weeks or so, I seem to run into this problem when trying to connect to the BDB:
"cannot open Berkeley DB file 'Default.db' in environment '/dev/shm/ca +che/bdb': Lock table is out of available locker entries at '/home/use +r/perl5/lib/perl5/CHI/Driver/BerkeleyDB.pm line 49."
A few Google searches havent really seemed to provide any useful answers or solutions.

The new constructor I'm using for CHI is:
our $chi = CHI->new( driver => 'BerkeleyDB', root_dir => '/dev/shm/cache/bdb', serializer => 'Storable', l1_cache => { driver => 'RawMemory', global => 1, max_size => 2 ** 15, } );
I've also tried the following based on some best guesses how to fix this:
sub _build_chi { my $root_dir = '/dev/shm/cache/bdb'; CHI->new( driver => 'BerkeleyDB', root_dir => $root_dir, serializer => 'Storable', env => BerkeleyDB::Env->new( '-Home' => $root_dir, '-Config' => {}, '-Flags' => DB_CREATE | DB_INIT_CDB | DB_INIT_MPOOL '-LockDetect' => DB_LOCK_OLDEST, ) ); }
But still encounter this issue. I'm guessing this is happening because there are some locks that are being created but not freed up from these long running processes, but I do not know enough about Berekeley DB or the BerkeleyDB Perl extension to know how to solve this. Are there any BDB wizards out there that have encountered this before? Any help is appreciated.

Replies are listed 'Best First'.
Re: CHI / BerkeleyDB Locker Entries
by Anonymous Monk on Jun 18, 2012 at 23:07 UTC

    A few Google searches havent really seemed to provide any useful answers or solutions.

    That is cause you're doing it wrong :) "Lock table is out of available locker entries" !google "Lock table is out of available locker entries"

    but I do not know enough about Berekeley DB or the BerkeleyDB Perl extension to know how to solve this

    Sure you do :) find places in code where locks (or cursors) are being created , and make sure they're unlocked (or closed )

    Or check the manual and FAQ :)

    What is Dumper output of  $db->db_stat ?

    What is

    print " BerkeleyDB $BerkeleyDB::VERSION db_version $BerkeleyDB::db_version ";

    Based on a cursory examination of CHI::Driver::BerkeleyDB, I suspect the only thing you need to do is upgrade to the latest dbd install, db-5.3.21

    Sure , writing a short snippet using perl threads to replicate your setup and trigger this error might help in Configuring locking: sizing the system, but I'd try the simplest thing first (upgrade)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://976889]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-23 17:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found