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

Coverity analysis defect 100734: Value not atomically updated

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Storage
    • Storage Execution
    • Fully Compatible
    • ALL

    Description

      Non-atomic update of a concurrently shared value

      Defect 100734 (STATIC_C)
      Checker ATOMICITY (subcategory none)
      File: /src/mongo/db/storage/kv/kv_storage_engine.cpp
      Function mongo::KVStorageEngine::dropDatabase(mongo::OperationContext *, mongo::StringData)
      /src/mongo/db/storage/kv/kv_storage_engine.cpp, line: 217
      Locking "this->_dbsLock".

                  stdx::lock_guard<stdx::mutex> lk(_dbsLock);

      /src/mongo/db/storage/kv/kv_storage_engine.cpp, line: 221
      Assigning data that might be protected by the lock to "entry".

                  entry = it->second;

      /src/mongo/db/storage/kv/kv_storage_engine.cpp, line: 222
      Unlocking "lk._M_device". "entry" might now be unreliable because other threads can now change the data that it depends on.

              }

      /src/mongo/db/storage/kv/kv_storage_engine.cpp, line: 243
      Locking "this->_dbsLock" again.

                  stdx::lock_guard<stdx::mutex> lk(_dbsLock);

      /src/mongo/db/storage/kv/kv_storage_engine.cpp, line: 244
      Using an unreliable value of "entry" inside the second locked section. If the data that "entry" depends on was changed by another thread, this use might be incorrect.

                  opCtx->recoveryUnit()->registerChange(new RemoveDBChange(this, db, entry));

      Attachments

        Activity

          People

            backlog-server-execution Backlog - Storage Execution Team
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: