Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-20074

Error when two connections try to open a new kvstore at the same time

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • .master
    • master
    • forestdb
    • None
    • Untriaged
    • MacOSX 64-bit
    • Unknown
    • ForestDB: Oct 17 - Nov 4

    Description

      I have a test with two threads that are opening & creating the same database file at the same time (with separate connections). One of the intermittent errors I'm seeing is a race condition where one of the connections fails to open a kv store — fdb_kvs_open logs "Failed to create KV Store" and returns FDB_RESULT_INVALID_KV_INSTANCE_NAME. This seems to happen because it first sees that the store doesn't exist, then goes to create it, but by the time it tries to create it the store has already been created by the other connection. Here's the relevant part of the backtrace:

          frame #4: 0x0000000100131cce libCBForest-Interop.dylib`::fdb_log(log_callback=0x0000000100504810, status=FDB_RESULT_INVALID_KV_INSTANCE_NAME, format="Failed to create KV Store '%s' as it already exists.") + 478 at filemgr.cc:168
        * frame #5: 0x0000000100192d3f libCBForest-Interop.dylib`_fdb_kvs_create(root_handle=0x00000001005046e0, kvs_name="myview", kvs_config=0x0000700000208eb0) + 671 at kv_instance.cc:1350
          frame #6: 0x0000000100192945 libCBForest-Interop.dylib`::_fdb_kvs_open(root_handle=0x00000001005046e0, config=0x0000700000208f00, kvs_config=0x0000700000208eb0, file=0x00000001023014c0, filename="/tmp/forest_temp.view.index", kvs_name="myview", handle=0x0000000100503810) + 325 at kv_instance.cc:1574
          frame #7: 0x00000001001939ef libCBForest-Interop.dylib`::fdb_kvs_open(fhandle=0x00000001005043f0, ptr_handle=0x0000700000209068, kvs_name="myview", kvs_config=0x0000000000000000) + 1967 at kv_instance.cc:1754
          frame #8: 0x000000010009e2bd libCBForest-Interop.dylib`cbforest::Database::getKeyStore(this=0x00000001005044d8, name="myview") const + 1645 at Database.cc:154
      

      I'm using the current latest stable commit, d16733d92.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jens Jens Alfke
            jens Jens Alfke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty