Skip to Main Content

Berkeley DB Family

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DbEnv::dbrename locks up on itself when CDB is initialized

Stone StepsJan 27 2019 — edited Jan 27 2019

When Berkeley DB is initialized with threading enabled, any attempt to rename a database results in a single-threaded deadlock within Berkeley DB. That is, if I run something like this against an existing database file with a database `ABC` inside, the `rename` call never returns:

dbenv.open(db_path, DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_THREAD | DB_INIT_CDB, 0664);

dbenv.dbrename(nullptr, db_path, "ABC", "XYZ", 0);

This is a series of lock calls `DbEnv::rename` makes. The`DbEnv::rename` call in each is the same single call made by the application using Berkeley DB (application stack frames are removed for clarity). Calls are captured from the first one (top) to the one that locks up (bottom):

libdb181d.dll!__lock_get

libdb181d.dll!__fop_file_setup

libdb181d.dll!__db_open

libdb181d.dll!__db_master_open

libdb181d.dll!__db_subdb_rename

libdb181d.dll!__db_rename_int

libdb181d.dll!__env_dbrename_pp

libdb181d.dll!DbEnv::dbrename

libdb181d.dll!__lock_get

libdb181d.dll!__fop_lock_handle

libdb181d.dll!__fop_file_setup

libdb181d.dll!__db_open

libdb181d.dll!__db_master_open

libdb181d.dll!__db_subdb_rename

libdb181d.dll!__db_rename_int

libdb181d.dll!__env_dbrename_pp

libdb181d.dll!DbEnv::dbrename

libdb181d.dll!__lock_get

libdb181d.dll!__db_cursor

libdb181d.dll!__bam_read_root

libdb181d.dll!__bam_open

libdb181d.dll!__db_open

libdb181d.dll!__db_master_open

libdb181d.dll!__db_subdb_rename

libdb181d.dll!__db_rename_int

libdb181d.dll!__env_dbrename_pp

libdb181d.dll!DbEnv::dbrename

libdb181d.dll!__lock_get

libdb181d.dll!__db_cursor

libdb181d.dll!__db_master_update

libdb181d.dll!__db_subdb_rename

libdb181d.dll!__db_rename_int

libdb181d.dll!__env_dbrename_pp

libdb181d.dll!DbEnv::dbrename

libdb181d.dll!__lock_get

libdb181d.dll!__dbc_idup

libdb181d.dll!__dbc_iget

libdb181d.dll!__dbc_get

libdb181d.dll!__db_master_update

libdb181d.dll!__db_subdb_rename

libdb181d.dll!__db_rename_int

libdb181d.dll!__env_dbrename_pp

libdb181d.dll!DbEnv::dbrename

libdb181d.dll!__lock_get

libdb181d.dll!__fop_lock_handle

libdb181d.dll!__db_subdb_rename

libdb181d.dll!__db_rename_int

libdb181d.dll!__env_dbrename_pp

libdb181d.dll!DbEnv::dbrename

libdb181d.dll!__lock_get

libdb181d.dll!__db_cursor

libdb181d.dll!__db_master_update

libdb181d.dll!__db_subdb_rename

libdb181d.dll!__db_rename_int

libdb181d.dll!__env_dbrename_pp

libdb181d.dll!DbEnv::dbrename

libdb181d.dll!__lock_get

libdb181d.dll!__dbc_idup

libdb181d.dll!__dbc_iget

libdb181d.dll!__dbc_get

libdb181d.dll!__db_master_update

libdb181d.dll!__db_subdb_rename

libdb181d.dll!__db_rename_int

libdb181d.dll!__env_dbrename_pp

libdb181d.dll!DbEnv::dbrename

libdb181d.dll!__lock_get

libdb181d.dll!__db_cursor

libdb181d.dll!__db_master_update

libdb181d.dll!__db_subdb_rename

libdb181d.dll!__db_rename_int

libdb181d.dll!__env_dbrename_pp

libdb181d.dll!DbEnv::dbrename

If I remove `DB_THREAD | DB_INIT_CDB` flags before calling `DbEnv::rename`, then the database is renamed properly.

I'm using a build of Berkeley DB v18.1.25 on Windows 10 built in Visual Studio 2017 for x64.

This is unrelated to the issue above, but I didn't want to create a separate issue - a bunch of callbacks in the environment are not initialized. Here's a few. Again, this is not related to the issue above, but it looks like something that shouldn't be happening, even if there is some flag saying whether they can be used or not, given that other callbacks are initialized.

NameValueType
backup_close_callback_0xccccccccccccccccint(*)(DbEnv *, const char *, void *)
backup_open_callback_0xccccccccccccccccint(*)(DbEnv *, const char *, const char *, void * *)
backup_write_callback_0xccccccccccccccccint(*)(DbEnv *, unsigned int, unsigned int, unsigned int, unsigned char *, void *)
isalive_callback_0xccccccccccccccccint(*)(DbEnv *, int, unsigned int, unsigned int)
error_callback_0xccccccccccccccccvoid(*)(const DbEnv *, const char *, const char *)
Comments
Post Details
Added on Jan 27 2019
0 comments
324 views