Operational Defect Database

BugZero found this defect 25 days ago.

MongoDB | 2652659

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

Last update date:

4/24/2024

Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:

No fixed releases provided.

Description:

Info

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/operation_context_group.cpp:66: LOCK_EVASION 141366 Thread1 uses the value read from field "_movedFrom" in the condition "!this->_movedFrom". It sees that the condition is true. Control is switched to Thread2. /src/mongo/db/operation_context_group.cpp:66: LOCK_EVASION 141366 Thread2 uses the value read from field "_movedFrom" in the condition "!this->_movedFrom". It sees that the condition is true. /src/mongo/db/operation_context_group.cpp:70: LOCK_EVASION 141366 Thread2 sets "_movedFrom" 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/operation_context_group.cpp:67: LOCK_EVASION 141366 Thread1 acquires lock "mongo::OperationContextGroup._lock". /src/mongo/db/operation_context_group.cpp:70: LOCK_EVASION 141366 Thread1 sets "_movedFrom" to a new value. Now the two threads have an inconsistent view of "_movedFrom" and updates to fields correlated with "_movedFrom" may be lost.

Top User Comments


Steps to Reproduce


Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

Needs Verification

Learn More

Search:

...