-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Replication
-
Fully Compatible
-
ALL
-
Repl 2024-02-05, Repl 2024-02-19
-
18
FeatureCompatibilityVersion::validateSetFeatureCompatibilityVersionRequest calls value() here on a boost::optional<BSONObj> it obtains from FeatureCompatibilityVersion::findFeatureCompatibilityVersionDocument.
findFeatureCompatabilityVersionDocument will return an uninitialized optional here if the underlying StorageInterface->findById fails for any reason (for example, if the opCtx is killed due to repl state change).
If we call value() on the optional when it is uninitialized, it will throw a boost::bad_optional_access exception, which is not caught in the server and will ultimately result in a server crash. We should check if the optional is none and propagate up a correct/useful error to the top layer.
FeatureCompatibilityVersion::updateFeatureCompatibilityVersionDocument seems to have the same problem here