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

don't give read lock when write lock needed in weird auth case

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.2
    • Affects Version/s: None
    • Component/s: None
    • None

      So I was able to create a new WRITE command that got run with a read lock and did an insert without asserting. Presumably a lockType=WRITE/requiresAuth=false combo is unusual. There are a couple such commands right now, but I think they would more properly have read locks. Might be worth putting a guard in execCommand() anyway.

      struct BogusCmd : public Command {
      BogusCmd() : Command( "bogus" ){}
      virtual bool slaveOk()

      { return true; }

      virtual LockType locktype()

      { return WRITE; }

      virtual bool requiresAuth()

      { return false; }

      virtual bool run(const char * badns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool)

      { log() << "mutex state: " << dbMutex.getState() << endl; BSONObj o = BSON( "a" << "b" ); theDataFileMgr.insert( "test.test", o ); return true; }

      } bogusCommand;

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: