This discussion is archived
4 Replies Latest reply: Sep 16, 2013 12:41 PM by LaurenFoutz RSS

Db::open hangs after restarting process post crash scenario

c6ae0fc6-e0c3-494d-9a53-09f8ec293b5e Newbie
Currently Being Moderated

Hi Friends,

 

My scenario is:

1. I'm using Bdb db in multi threaded environment.

2. My process crashed due to some reason. Environment / db were not closed properly before the crash.

3. I restarted the process, and the Db::open call hanged.

 

Here is the stack trace:

 

Thread 66 (LWP 16050):

#0  0x00007ffb80857d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0

#1  0x00007ffb8108134b in __db_pthread_mutex_lock () from /usr/lib/x86_64-linux-gnu/libdb_cxx-5.1.so

#2  0x00007ffb8110f262 in __lock_get_internal () from /usr/lib/x86_64-linux-gnu/libdb_cxx-5.1.so

#3  0x00007ffb8110f7bb in __lock_get () from /usr/lib/x86_64-linux-gnu/libdb_cxx-5.1.so

#4  0x00007ffb811376bb in __db_lget () from /usr/lib/x86_64-linux-gnu/libdb_cxx-5.1.so

#5  0x00007ffb81090145 in __bam_read_root () from /usr/lib/x86_64-linux-gnu/libdb_cxx-5.1.so

#6  0x00007ffb8113b212 in __db_open () from /usr/lib/x86_64-linux-gnu/libdb_cxx-5.1.so

#7  0x00007ffb81134ab8 in __db_open_pp () from /usr/lib/x86_64-linux-gnu/libdb_cxx-5.1.so

#8  0x00007ffb81076a69 in Db::open(DbTxn*, char const*, char const*, DBTYPE, unsigned int, int) () from /usr/lib/x86_64-linux-gnu/libdb_cxx-5.1.so

#9  0x0000000000410aac in BdbDB::dbOpen (this=0x2174f60) at db.cpp:89

 

My pseudo source code is as below:

 

BdbDB::dbOpen()

 

{

    UINT32          db_flags, env_flags;

 

    m_env = new DbEnv(0);

    env_flags =  DB_CREATE |    /* Create the environment */

                      DB_INIT_LOCK | /* Initialize locking. */

                      DB_THREAD |    /* Enable threading */

                      DB_INIT_MPOOL; /* Initialize the in-memory cache. */

     m_env->open(m_dbPath.c_str(), env_flags, 0);

 

     db_flags = DB_CREATE;

     m_db = new Db(m_env, 0);

     m_db->open (NULL,

                         m_dbName.c_str(),

                         NULL,

                         DB_BTREE,

                         db_flags,

                         0);

     return;

}

 

Kindly help me to find the solution for this hang situation.

 

Regards,
~ Ashish K.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points