niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Berkeley DB
WAS_WRITE lock leaking with DB_DIRTY_READ & DB_AUTO_COMMIT turn on
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
sub.apache@gmail.com
*nix forums beginner


Joined: 11 Jul 2006
Posts: 3

PostPosted: Sun Jul 16, 2006 11:48 pm    Post subject: WAS_WRITE lock leaking with DB_DIRTY_READ & DB_AUTO_COMMIT turn on Reply with quote

Hi, I has a hash based berkeley db (4.4) with DB_AUTO_COMMIT on
and it works fine. But once I turned on both DB_DIRTY_READ
and DB_AUTO_COMMIT, it generates a WAS_WRITE lock after every
DB->put() operation without releasing it. So after a while, it
ran out of all locks (default 64K) and reached error of
"BERKELEY DB: Lock table is out of available object entries".

I didn't generate any transaction explicitly in my application.
I didn't make any DB->get() or cursor call. I didn't share
the db with other process. The txn_stat output
didn't show any transaction holding those WAS_WRITE locks.
If I removed DB_DIRTY_READ in the open() call, this lock
leaking problem is gone.

Any idea why the db is holding WAS_WRITE lock after the
DB->put() is done ? How can I find out which transaction
is holding those locks ? Thanks in advanced. - John


Here the db create code: --------------------
rc = db_env->open( db_env,
my_home,
DB_CREATE |
DB_INIT_LOCK |
DB_INIT_LOG |
DB_INIT_TXN |
DB_INIT_MPOOL |
DB_PRIVATE ,
0 );


rc = db->open(db, NULL, my_file_name, NULL, DB_HASH, DB_CREATE,
DB_PERMS);
db->close(db, 0);


Here db open code: -----------------------
rc = db_env->set_flags(db_env, DB_AUTO_COMMIT, 1);

rc = my_db->open( db_env,
NULL, /*txn*/
my_file_name,
NULL,
DB_UNKNOWN,
DB_THREAD , DB_DIRTY_READ,
0664 );


Here's the lock_stat output: ---------------


Default locking region information:
3 Last allocated locker ID
0x7fffffff Current maximum unused locker ID
9 Number of lock modes
65536 Maximum number of locks possible
128 Maximum number of lockers possible
65536 Maximum number of lock objects possible
6 Number of current locks
7 Maximum number of locks at any one time
2 Number of current lockers
2 Maximum number of lockers at any one time
6 Number of current lock objects
7 Maximum number of lock objects at any one time
114 Total number of locks requested
108 Total number of locks released
0 Total number of locks upgraded
1 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
13MB 152KB The size of the lock region
0 The number of region locks that required waiting (0%)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Lock REGINFO information:
Lock Region type
5 Region ID
/db/1/__db.005 Region name
0xbe3cad0 Original region address
0xbe3cad0 Region address
0xbe3cb28 Region primary address
13787136 Region maximum allocation
13787136 Region allocated
REGION_CREATE, REGION_CREATE_OK, REGION_JOIN_OK Region flags
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Lock region parameters:
2062 Lock region region mutex [0/241 0% 12274/3076336544]
131 locker table size
65537 object table size
199554752 obj_off
199478360 locker_off
0 need_dd
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Lock conflict matrix:
0 0 0 0 0 0 0 0 0

0 0 1 0 1 0 1 0 1

0 1 1 1 1 1 1 1 1

0 0 0 0 0 0 0 0 0

0 1 1 0 0 0 0 1 1

0 0 1 0 0 0 0 0 1

0 1 1 0 0 0 0 1 1

0 0 1 0 1 0 1 0 0

0 1 1 0 1 1 1 0 1

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Locks grouped by lockers:
Locker Mode Count Status ----------------- Object
---------------
2 dd= 0 locks held 1 write locks 0 pid/thread
12274/3086829760
2 READ 1 HELD my_test.db4.4 handle
0
3 dd= 0 locks held 5 write locks 5 pid/thread
12274/3065846688
3 WAS_WRITE 1 HELD my_test.db4.4 page
83096
3 WAS_WRITE 1 HELD my_test.db4.4 page
62334
3 WAS_WRITE 1 HELD my_test.db4.4 page
24944
3 WAS_WRITE 1 HELD my_test.db4.4 page
28650
3 WAS_WRITE 1 HELD my_test.db4.4 page
72029
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Locks grouped by object:
Locker Mode Count Status ----------------- Object
---------------
3 WAS_WRITE 1 HELD my_test.db4.4 page
24944

3 WAS_WRITE 1 HELD my_test.db4.4 page
28650

3 WAS_WRITE 1 HELD my_test.db4.4 page
83096

3 WAS_WRITE 1 HELD my_test.db4.4 page
72029

2 READ 1 HELD my_test.db4.4 handle
0

3 WAS_WRITE 1 HELD my_test.db4.4 page
62334



Here is the txn_stat output -----------------


Default transaction region information:
1/68944 File/offset for last checkpoint LSN
Sun Jul 16 14:22:24 2006 Checkpoint timestamp
0x80000000 Last transaction ID allocated
20 Maximum number of active transactions configured
0 Active transactions
0 Maximum active transactions
0 Number of transactions begun
0 Number of transactions aborted
0 Number of transactions committed
0 Number of transactions restored
16KB Transaction region size
0 The number of region locks that required waiting (0%)
Active transactions:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Transaction REGINFO information:
Transaction Region type
6 Region ID
/db/1/__db.006 Region name
0xab455c0 Original region address
0xab455c0 Region address
0xab45618 Region primary address
16384 Region maximum allocation
16384 Region allocated
REGION_CREATE, REGION_CREATE_OK, REGION_JOIN_OK Region flags
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
DB_TXNMGR handle information:
2065 DB_TXNMGR mutex [0/0 0% !Own]
0 Number of transactions discarded
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
DB_TXNREGION handle information:
2063 DB_TXNREGION region mutex [0/9 0% 10783/3076389792]
20 Maximum number of active txns
0x80000000 Last transaction ID allocated
0xffffffff Current maximum unused ID
2064 checkpoint mutex [0/2 0% !Own]
1/68944 Last checkpoint LSN
Sun Jul 16 14:22:24 2006 Last checkpoint timestamp
Flags
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
XA information:
0 XA RMID
Back to top
ubell@sleepycat.com
*nix forums beginner


Joined: 06 Jun 2005
Posts: 49

PostPosted: Mon Jul 17, 2006 4:04 pm    Post subject: Re: WAS_WRITE lock leaking with DB_DIRTY_READ & DB_AUTO_COMMIT turn on Reply with quote

Quote:
rc = my_db->open( db_env,
NULL, /*txn*/
my_file_name,
NULL,
DB_UNKNOWN,
DB_THREAD , DB_DIRTY_READ,
0664 );



Not sure if this is the problem, but the first parameter to DB->open is
the database handle not the environment handle.

Michael Ubell
Sleepycat Software.
Back to top
sub.apache@gmail.com
*nix forums beginner


Joined: 11 Jul 2006
Posts: 3

PostPosted: Tue Jul 18, 2006 1:40 am    Post subject: Re: WAS_WRITE lock leaking with DB_DIRTY_READ & DB_AUTO_COMMIT turn on Reply with quote

Thanks for the update. That actual code is using db handle and the
program does work
for 64k put() calls. But in order to make the post shorter, I replaced
the original long db handle with the wrong typing.

Mike wrote:
Quote:
Not sure if this is the problem, but the first parameter to DB->open is
the database handle not the environment handle.
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Mon Dec 01, 2008 10:21 pm | All times are GMT
navigation Forum index » Databases » Berkeley DB
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts turn off autoreply when mailbox full bxd20 Postfix 1 Mon Mar 03, 2008 9:55 pm
No new posts effects of aquiring exclusive lock on subsequent reads in... Nikita Tovstoles MySQL 0 Thu Jul 20, 2006 11:01 pm
No new posts Unable to lock a file to stop sendmail writing to it GarfGarf Perl 4 Thu Jul 20, 2006 8:54 am
No new posts Mysql ver. 5.0.22-standard for sun-solaris2.10 (SPARC): E... Calselli, Fabrizio WI MySQL 1 Tue Jul 18, 2006 3:23 pm
No new posts Random Table Lock mysql@top-consulting.net MySQL 0 Mon Jul 17, 2006 11:39 am

Online Advertising | Personal Finance | Loans | Free Ringtones | Shares
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1613s ][ Queries: 16 (0.0745s) ][ GZIP on - Debug on ]