Operational Defect Database

BugZero found this defect 25 days ago.

MongoDB | 2652658

Coverity analysis defect 144678: 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/s/range_deleter_service.cpp:389: LOCK_EVASION 144678 Thread1 uses the value read from field "_state" in the condition "this->this->_state != mongo::RangeDeleterService::kInitializing". It sees that the condition is false. /src/mongo/db/s/range_deleter_service.cpp:469: LOCK_EVASION 144678 Thread1 double checks the field "_state" in the condition "this->this->_state != mongo::RangeDeleterService::kDown". /src/mongo/db/s/range_deleter_service.cpp:470: LOCK_EVASION 144678 Thread1 modifies the field "_state". This modification can be re-ordered with other correlated field assignments within this critical section at runtime. Thus, checking the value of "_state" is not an adequate test that the critical section has completed unless the guarding lock is held while checking. Control is switched to Thread2. /src/mongo/db/s/range_deleter_service.cpp:389: LOCK_EVASION 144678 Thread2 checks "_state", reading it after Thread1 assigns to "_state" but before some of the correlated field assignments can occur. It sees the condition "this->this->_state != mongo::RangeDeleterService::kInitializing" as being true. It continues on before the critical section has completed, and can read data changed by that critical section while it is in an inconsistent state. /src/mongo/db/s/range_deleter_service.cpp:395: LOCK_EVASION 144678 The modification of "this" can race with the unguarded check of "_state". /src/mongo/db/s/range_deleter_service.cpp:408: LOCK_EVASION 144678 The modification of "_viewMode" can race with the unguarded check of "_state". /src/mongo/db/s/range_deleter_service.cpp:408: LOCK_EVASION 144678 The modification of "millis" can race with the unguarded check of "_state".

Top User Comments


Steps to Reproduce


Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

Needs Verification

Learn More

Search:

...