[SERVER-16504] Repl threads are performing NamespaceIndex operations with DB IX lock Created: 11/Dec/14  Updated: 11/Dec/14  Resolved: 11/Dec/14

Status: Closed
Project: Core Server
Component/s: Replication, Storage
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Critical - P2
Reporter: Kaloian Manassiev Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-16503 replication should obtain DB X lock w... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

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]


Generated at Thu Feb 08 03:41:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.