-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Internal Code
-
None
-
Fully Compatible
-
ALL
-
Platform 9 (09/18/15), Platform A (10/09/15)
ExportedServerParameter does not protect the underlying templated variable from concurrent access.
The following construct is hence not safe if maxConsecutiveFailedChecks is ever read without holding a lock preventing a setParameter call:
ExportedServerParameter<int> MaxConsecutiveFailedChecksSetting( ServerParameterSet::getGlobal(), "replMonitorMaxFailedChecks", &ReplicaSetMonitor::maxConsecutiveFailedChecks, false, // allowedToChangeAtStartup true); // allowedToChangeAtRuntime
We could either:
1) Prevent ExportedServerParameter to be configured with allowedToChangeAtRuntime = true, and make implementers having to inherit from ServerParameter directly, or
2) Use a mutex in ExportedServerParameter or use atomics for the template specializations where that make sense.
Regardless we should audit the existing uses of ExportedServerParameter.
- related to
-
SERVER-20441 ReplIndexPrefetch Server Parameter is not thread-safe
- Closed