Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-16504

Repl threads are performing NamespaceIndex operations with DB IX lock

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: None
    • Component/s: Replication, Storage
    • None
    • Fully Compatible
    • ALL

      I tightened some assertions in the NamespaceIndex code for MMAP V1 and I noticed that repl log replay threads are accessing it with only DB IX lock. This has the potential for corrupting the .ns file.

      Here is a call stack I am referring to:

      m31101| 2014-12-11T00:07:34.462-0500 I -        [repl writer worker 15] Invariant failure txn->lockState()->isDbLockedForMode(nss.db(), MODE_X) src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp 76
       m31101|  mongod(mongo::invariantFailed(char const*, char const*, unsigned int) 0xB2) [0xe955b2]
       m31101|  mongod(mongo::NamespaceIndex::add_ns(mongo::OperationContext*, mongo::Namespace const&, mongo::NamespaceDetails const*) 0x462) [0xcd62a2]
       m31101|  mongod(mongo::NamespaceIndex::add_ns(mongo::OperationContext*, mongo::StringData const&, mongo::NamespaceDetails const*) 0x5C) [0xcd63cc]
       m31101|  mongod(mongo::NamespaceIndex::add_ns(mongo::OperationContext*, mongo::StringData const&, mongo::DiskLoc const&, bool) 0x36) [0xcd6466]
       m31101|  mongod(mongo::MMAPV1DatabaseCatalogEntry::createNamespaceForIndex(mongo::OperationContext*, mongo::StringData const&) 0x75) [0xcfe0f5]
       m31101|  mongod(mongo::NamespaceDetailsCollectionCatalogEntry::prepareForIndexBuild(mongo::OperationContext*, mongo::IndexDescriptor const*) 0x1C7) [0xcd2027]
       m31101|  mongod(mongo::IndexCatalog::IndexBuildBlock::init() 0xEB) [0x8fd53b]
       m31101|  mongod(mongo::MultiIndexBlock::init(std::vector<mongo::BSONObj, std::allocator<mongo::BSONObj> > const&) 0x6F7) [0x9057c7]
       m31101|  mongod(mongo::IndexBuilder::_build(mongo::OperationContext*, mongo::Database*, bool, mongo::Lock::DBLock*) const 0x20C) [0xa7d90c]
       m31101|  mongod(mongo::IndexBuilder::buildInForeground(mongo::OperationContext*, mongo::Database*) const 0xF) [0xa7ddff]
       m31101|  mongod(mongo::repl::applyOperation_inlock(mongo::OperationContext*, mongo::Database*, mongo::BSONObj const&, bool, bool) 0x1351) [0xc12e91]
       m31101|  mongod(mongo::repl::SyncTail::syncApply(mongo::OperationContext*, mongo::BSONObj const&, bool) 0x4F0) [0xc6a430]
       m31101|  mongod(mongo::repl::multiSyncApply(std::vector<mongo::BSONObj, std::allocator<mongo::BSONObj> > const&, mongo::repl::SyncTail*) 0x5D) [0xc6d32d]
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: