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

Acquiring lock in any mode on the Locker without first acquiring the global lock in IX mode fails an invariant

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.7.7
    • Component/s: Concurrency
    • ALL
    • Hide

      This code was taken from a threaded test. I don't think it needs to be threaded to hit the issue.

      Initialization code:
      boost::thread_specific_ptr<mongo::newlm::ResourceId> resId;
      boost::thread_specific_ptr<Locker> locker;
      mongo::newlm::LockMode lockMode = mongo::newlm::MODE_X
      resId.reset(new mongo::newlm::ResourceId(mongo::newlm::RESOURCE_COLLECTION, std::string("TestDB.collection")
      locker.reset(new mongo::newlm::LockerImpl());

      And then this code in a loop
      locker->lock(*resId, lockMode);
      locker->unlockAll();

      Or pull from here: https://github.com/dalyd/mongo/commit/2d62983ae826a7674ac45b83d0986cb84f90befb
      lock_mgr_perf branch.
      scons dbtest
      ./dbtest perf

      Show
      This code was taken from a threaded test. I don't think it needs to be threaded to hit the issue. Initialization code: boost::thread_specific_ptr<mongo::newlm::ResourceId> resId; boost::thread_specific_ptr<Locker> locker; mongo::newlm::LockMode lockMode = mongo::newlm::MODE_X resId.reset(new mongo::newlm::ResourceId(mongo::newlm::RESOURCE_COLLECTION, std::string("TestDB.collection") locker.reset(new mongo::newlm::LockerImpl()); And then this code in a loop locker->lock(*resId, lockMode); locker->unlockAll(); Or pull from here: https://github.com/dalyd/mongo/commit/2d62983ae826a7674ac45b83d0986cb84f90befb lock_mgr_perf branch. scons dbtest ./dbtest perf
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None

      Locking a resource MODE_X without first getting a global MODE_IX lock causes an invariant failure and crashes.

      2014-10-02T09:45:58.583-0400 I - [perftestthr] Invariant failure request src/mongo/db/concurrency/lock_state.cpp 519

            Assignee:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Reporter:
            david.daly@mongodb.com David Daly (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: