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

Coverity analysis defect 146234: Check of thread-shared field evades lock acquisition

    • Cluster Scalability
    • Fully Compatible
    • ALL
    • v8.0, v7.3, v7.0, v6.0, v5.0

      Check of thread-shared field evades lock acquisition

      The data guarded by this critical section may be read while in an inconsistent state or modified by multiple racing threads. Checking the value of a thread-shared field outside of a locked region to determine if a locked operation involving that thread shared field has completed.
      /src/mongo/db/s/transaction_coordinator_futures_util.cpp:90: LOCK_EVASION 146234 Thread1 uses the value read from field "_parent" in the condition "!this->_parent". It sees that the condition is false. Control is switched to Thread2.
      /src/mongo/db/s/transaction_coordinator_futures_util.cpp:90: LOCK_EVASION 146234 Thread2 uses the value read from field "_parent" in the condition "!this->_parent". It sees that the condition is false.
      /src/mongo/db/s/transaction_coordinator_futures_util.cpp:96: LOCK_EVASION 146234 Thread2 sets "_parent" to a new value. Note that this write can be reordered at runtime to occur before instructions that do not access this field within this locked region. After Thread2 leaves the critical section, control is switched back to Thread1.
      /src/mongo/db/s/transaction_coordinator_futures_util.cpp:93: LOCK_EVASION 146234 Thread1 acquires lock "mongo::txn::AsyncWorkScheduler._mutex".
      /src/mongo/db/s/transaction_coordinator_futures_util.cpp:96: LOCK_EVASION 146234 Thread1 sets "_parent" to a new value. Now the two threads have an inconsistent view of "_parent" and updates to fields of "_parent" or fields correlated with "_parent" may be lost.

            Assignee:
            nandini.bhartiya@mongodb.com Nandini Bhartiya
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: