Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-12871

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

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Not Applicable
    • None
    • Storage Engines
    • Not Needed

      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.
      /opt/mongodbtoolchain/revisions/11316f1e7b36f08dcdd2ad0640af18f9287876f4/stow/gcc-v4.D1Q/include/c++/11.3.0/bits/unique_lock.h:135: LOCK_EVASION 138929 Thread1 uses the value read from field "_M_owns" in the condition "this->_M_owns". It sees that the condition is false. Control is switched to Thread2.
      /opt/mongodbtoolchain/revisions/11316f1e7b36f08dcdd2ad0640af18f9287876f4/stow/gcc-v4.D1Q/include/c++/11.3.0/bits/unique_lock.h:135: LOCK_EVASION 138929 Thread2 uses the value read from field "_M_owns" in the condition "this->_M_owns". It sees that the condition is false.
      /opt/mongodbtoolchain/revisions/11316f1e7b36f08dcdd2ad0640af18f9287876f4/stow/gcc-v4.D1Q/include/c++/11.3.0/bits/unique_lock.h:139: LOCK_EVASION 138929 Thread2 acquires lock "std::unique_lock<std::shared_mutex>._M_device".
      /opt/mongodbtoolchain/revisions/11316f1e7b36f08dcdd2ad0640af18f9287876f4/stow/gcc-v4.D1Q/include/c++/11.3.0/bits/unique_lock.h:140: LOCK_EVASION 138929 Thread2 sets "_M_owns" 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.
      /opt/mongodbtoolchain/revisions/11316f1e7b36f08dcdd2ad0640af18f9287876f4/stow/gcc-v4.D1Q/include/c++/11.3.0/bits/unique_lock.h:139: LOCK_EVASION 138929 Thread1 acquires lock "std::unique_lock<std::shared_mutex>._M_device".
      /opt/mongodbtoolchain/revisions/11316f1e7b36f08dcdd2ad0640af18f9287876f4/stow/gcc-v4.D1Q/include/c++/11.3.0/bits/unique_lock.h:140: LOCK_EVASION 138929 Thread1 sets "_M_owns" to a new value. Now the two threads have an inconsistent view of "_M_owns" and updates to fields correlated with "_M_owns" may be lost.

            Assignee:
            Unassigned Unassigned
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: