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

forestdb: Memory leaks in ep-engine_kvstore_test

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 4.5.0
    • .master
    • forestdb
    • Security Level: Public
    • None
    • Untriaged
    • Unknown
    • ForestDB: Oct 17 - Nov 4

    Description

      The ep-engine_kvstore_test unit test, when run under Valgrind reports a number of memory leaks. I've briefly looked into these and they only appear when the forestdb variant runs.

      See for example: http://factory.couchbase.com/view/build/view/commit_validation/view/ep-engine/job/ep-engine-gerrit-master-multi/2535/label_exp=sherlocker-ubuntu12.04/valgrindResult/pid=155648/

      There are a number of leaks, the biggest of which looks like the block cache not getting freed:

      ==842== 134,217,728 bytes in 1 blocks are still reachable in loss record 20 of 20
      ==842==    at 0x7BBC6DC: je_malloc (jemalloc.c:1441)
      ==842==    by 0x5693D8C: bcache_init (blockcache.cc:1390)
      ==842==    by 0x56AB5AB: filemgr_init (filemgr.cc:226)
      ==842==    by 0x56B5FFA: fdb_init (forestdb.cc:681)
      ==842==    by 0x4592C5: ForestKVStore::initForestDb() (forest-kvstore.cc:37)
      ==842==    by 0x4599E0: ForestKVStore::ForestKVStore(KVStoreConfig&) (forest-kvstore.cc:109)
      ==842==    by 0x43A956: KVStoreFactory::create(KVStoreConfig&, bool) (kvstore.cc:55)
      ==842==    by 0x42A45C: setup_kv_store(KVStoreConfig&) (kvstore_test.cc:115)
      ==842==    by 0x42A8D1: CouchAndForestTest_BasicTest_Test::TestBody() (kvstore_test.cc:152)
      ==842==    by 0x49A971: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2078)
      ==842==    by 0x4965A7: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2114)
      ==842==    by 0x47F3E8: testing::Test::Run() (gtest.cc:2151)
      

      A (very) brief investigation shows that fdb_open_inprog is still 1 when we call fdb_shutdown in the unit test, which means that shutdown fails (and we never call filemgr_shutdown() - see https://github.com/couchbase/forestdb/blob/master/src/forestdb.cc#L7666

      Attachments

        Issue Links

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

          Activity

            People

              chiyoung Chiyoung Seo (Inactive)
              drigby Dave Rigby (Inactive)
              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