diff --git a/engines/ep/tests/module_tests/ep_unit_tests_main.cc b/engines/ep/tests/module_tests/ep_unit_tests_main.cc index 2c9af86d49..6817270d2f 100644 --- a/engines/ep/tests/module_tests/ep_unit_tests_main.cc +++ b/engines/ep/tests/module_tests/ep_unit_tests_main.cc @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -163,6 +164,14 @@ int main(int argc, char **argv) { env.engineFileDescriptors = env.reservedFileDescriptors * 2; } + // Ensure phosphor TraceLog singleton is initialised before we run any + // tests - specifically before we create the ExecutorPool singleton and + // its background threads. If TraceLog is *not* initialised before + // ExecutorPool, then it will also be destroyed before ExecutorPool; which + // then results in ExecutorPool crashing when it attempts to unregister + // worker threads from phosphor. + phosphor::TraceLog::getInstance(); + auto ret = RUN_ALL_TESTS(); globalBucketLogger.reset();