-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Replication
-
Labels:None
-
Fully Compatible
-
ALL
-
Repl 2020-02-24
The way that the failWithErrorCodeInRunCommand failpoint is currently implemented is possibly racey.
The check against shouldFail only indicates the failpoint was active at that particular instant and it is possible that the failpoint gets turned off immediately after, meaning the following call to 'getData' will fassert.
We should instead do something along the lines of
if (MONGO_UNLIKELY(failWithErrorCodeInRunCommand.scopedIf([&](const BSONObj& data){ return data.hasField(...) ...; }.isActive())) { // build error reply. }