-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Internal Code
-
Fully Compatible
-
ALL
-
In a _DEBUG build we enable the "MutexDebugger", which is invoked during Mutex operations. The MutexDebugger global object is an extern static in the mutex_debugger.cpp TU. There is no assurance that the static initializer for the global has run when methods are invoked.
The MutexDebugger attempts to defend from this by checking if this == NULL, however, this is too late:
https://github.com/mongodb/mongo/blob/master/src/mongo/util/concurrency/mutexdebugger.h#L90
since invoking a method on a null object is undefined behavior at the point of the call.
We should evaluate the benefits of the MutexDebugger. If it is determined to be useful, we should fix it so that it has defined behavior. Otherwise, we should remove it, or add a ubsan suppression.