-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Initialization order fiasco in GlobalLoggingInitCall and TraceManager #17792
Copy link
Copy link
Closed
Labels
Milestone
Description
System information (version)
- OpenCV => 4.3 and master
Detailed description
This triggers address sanitizers.
In modules/core/src/logger.cpp, there is the following static:
static GlobalLoggingInitCall globalLoggingInitCall;
Its constructor calls getGlobalLoggingInitStruct which creates a GlobalLoggingInitStruct.
If you continue down the trace, you get (line numbers might be slightly off).
#0 in cv::utils::trace::details::TraceManager::TraceManager() modules/core/src/trace.cpp:844:17
#1 in cv::utils::trace::details::getTraceManagerCallOnce() modules/core/src/trace.cpp:917:25
#2 in cv::utils::trace::details::getTraceManager() modules/core/src/trace.cpp:922:5
#3 in cv::utils::trace::details::TraceManager::isActivated() modules/core/src/trace.cpp:907:27
#4 in cv::utils::trace::details::Region::Region(cv::utils::trace::details::Region::LocationStaticStorage const&) modules/core/src/trace.cpp:442:10
#5 in cv::utils::logging::LogTagManager::assign(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::utils::logging::LogTag*) modules/core/src/utils/logtagmanager.cpp>
#6 in cv::utils::logging::LogTagManager::LogTagManager(cv::utils::logging::LogLevel) modules/core/src/utils/logtagmanager.cpp:22:5
#7 in cv::utils::logging::internal::GlobalLoggingInitStruct::GlobalLoggingInitStruct() modules/core/src/logger.cpp:46:11
#8 in cv::utils::logging::internal::getGlobalLoggingInitStruct() modules/core/src/logger.cpp:97:36
#9 in cv::utils::logging::internal::GlobalLoggingInitCall::GlobalLoggingInitCall() modules/core/src/logger.cpp:110:9
And the TraceManager needs the static param_traceEnable in its constructor.
The static globalLoggingInitCall depends on the static param_traceEnable from a different compilation unit hence the initialization order fiasco.
Reactions are currently unavailable