3 Replies Latest reply on Oct 23, 2007 9:31 AM by Andrei Costache-Oracle

    multiple environments in multi-thread context met problems..

    603916
      Hi all,
      I've created 2 subdirectories in which I've set up Concurrent Data Store environment separately.
      My program is a multi-thread one, and some of the threads need to access the Berkeley database.
      I've set the DB_THERAD flag when creating DB_ENV and DB handles. The problem is, when accessing the Bekerley DB (inside DB->get() function), I got the following assertion errors from libc.

      *** glibc detected *** double free or corruption (fasttop): 0x080860f8 ***

      And if there is only one thread, everything goes quite well..
      Dose anyone have any idea of this problem?
      Thank you :)
        • 1. Re: multiple environments in multi-thread context met problems..
          Andrei Costache-Oracle
          Hi,

          Is there a stack trace along with that error?
          If it's possible put together a simple testcase program that demonstrates this issue and post it here. Also, provide information on the BDB version you're using, if you've applied all patches corresponding to the BDB release, what's the platform/OS you're running on, the gcc's version and compile/link options used.

          Regards,
          Andrei
          • 2. Re: multiple environments in multi-thread context met problems..
            603916
            Hi, the following is the back trace of the stack of my program when it crashed
            I'm using Berkeley DB 4.6.21, my os is Linux x86(32bit) with kernel version 2.6.17.13 and my GCC is v3.4.5.

            Hope that this will help..
            (gdb) bt
            #0 0xffffe410 in __kernel_vsyscall ()
            #1 0x477257f5 in raise () from /lib/tls/libc.so.6
            #2 0x47727199 in abort () from /lib/tls/libc.so.6
            #3 0x477594ea in __libc_message () from /lib/tls/libc.so.6
            #4 0x4775fc6f in intfree () from /lib/tls/libc.so.6
            #5 0x47761591 in intrealloc () from /lib/tls/libc.so.6
            #6 0x47762786 in realloc () from /lib/tls/libc.so.6
            #7 0xb7f6286c in __os_realloc () from /usr/local/BerkeleyDB.4.6/lib/libdb-4.6.so
            #8 0xb7f32d75 in __db_retcopy () from /usr/local/BerkeleyDB.4.6/lib/libdb-4.6.so
            #9 0xb7f32eaf in __db_ret () from /usr/local/BerkeleyDB.4.6/lib/libdb-4.6.so
            #10 0xb7f19708 in __dbc_get () from /usr/local/BerkeleyDB.4.6/lib/libdb-4.6.so
            #11 0xb7f21318 in __db_get () from /usr/local/BerkeleyDB.4.6/lib/libdb-4.6.so
            #12 0xb7f24406 in __db_get_pp () from /usr/local/BerkeleyDB.4.6/lib/libdb-4.6.so

            This is happened when executing DB->get().

            And meanwhile, I'm trying to write a minimum test case program, see whether I could make this problem re-appear..

            Thank you for your help! ^_^

            Message was edited by:
            user600913
            • 3. Re: multiple environments in multi-thread context met problems..
              Andrei Costache-Oracle
              Hi,

              There's a call to realloc() in the back trace, so, until the testcase will be ready, could you post here the snippets of code from the threads that perform the reads, and the snippet of code around the DB->get() call where you get the crash? I'm particularly interested in the flags that you set on the "data" DBT when doing the retrieval.
              Also, have you tried the program on a different system with a different "libc" version and run the program under a memory leak detection tool like Purify or Valgrind?

              Regards,
              Andrei