[
https://issues.apache.org/jira/browse/LOGCXX-532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17476994#comment-17476994
]
Stephen Webb commented on LOGCXX-532:
-------------------------------------
Some tests SegFault on Windows (using Visual Studio 2019) when they are
statically linked (using next_stable branch). The fault in
Level::initializeLevels() suggests the global initialisation order problem is
not completely fixed.
The stack trace is:
msvcp140d.dll!00007fff6a9e3240() Unknown
msvcp140d.dll!00007fff6a9e37f5() Unknown
> hierarchythresholdtestcase.exe!std::_Mutex_base::lock() Line 51 C++
hierarchythresholdtestcase.exe!std::unique_lock<std::mutex>::unique_lock<std::mutex>(std::mutex
& _Mtx) Line 138 C++
hierarchythresholdtestcase.exe!log4cxx::Level::initializeLevels() Line 51
C++
hierarchythresholdtestcase.exe!log4cxx::Level::getDebug() Line 103 C++
hierarchythresholdtestcase.exe!log4cxx::Hierarchy::HierarchyPrivate::HierarchyPrivate()
Line 56 C++
[External Code]
hierarchythresholdtestcase.exe!log4cxx::Hierarchy::Hierarchy() Line 89
C++
hierarchythresholdtestcase.exe!log4cxx::Hierarchy::create() Line 446 C++
hierarchythresholdtestcase.exe!log4cxx::LogManager::getRepositorySelector::__l2::<lambda>()
Line 55 C++
[External Code]
hierarchythresholdtestcase.exe!log4cxx::helpers::APRInitializer::findOrAddObject(unsigned
__int64 key, std::function<std::shared_ptr<log4cxx::helpers::Object>
__cdecl(void)> creator) Line 145 C++
hierarchythresholdtestcase.exe!log4cxx::helpers::APRInitializer::getOrAddUnique<log4cxx::spi::RepositorySelector>(std::function<std::shared_ptr<log4cxx::helpers::Object>
__cdecl(void)> creator) Line 70 C++
hierarchythresholdtestcase.exe!log4cxx::LogManager::getRepositorySelector()
Line 59 C++
hierarchythresholdtestcase.exe!log4cxx::LogManager::getLoggerRepository()
Line 82 C++
hierarchythresholdtestcase.exe!log4cxx::LogManager::getLoggerLS(const
std::wstring & name) Line 96 C++
hierarchythresholdtestcase.exe!log4cxx::LogManager::getLogger(const
std::string & name) Line 112 C++
hierarchythresholdtestcase.exe!log4cxx::Logger::getLogger(const char *
const name) Line 535 C++
hierarchythresholdtestcase.exe!`dynamic initializer for
'HierarchyThresholdTestCase::logger''() Line 134 C++
[External Code]
> Static objects and deleting
> ---------------------------
>
> Key: LOGCXX-532
> URL: https://issues.apache.org/jira/browse/LOGCXX-532
> Project: Log4cxx
> Issue Type: Improvement
> Reporter: Robert Middleton
> Assignee: Robert Middleton
> Priority: Minor
>
> As seen in LOGCXX-430 and LOGCXX-322, making sure that when an application
> terminates earlier than expected we don't crash is rather hard to do.
> I came across this solution when researching this problem:
> https://stackoverflow.com/a/470545/624483
> My thought is that we create something like a log4cxx::Globals class, which
> contains a smart pointer to everything that must be kept alive before the
> library can safely be unloaded. In each thread, you would do something like:
> {{GlobalsPtr globals = log4cxx::globals;}}
> thus ensuring that the destructor can't run before all of the threads are
> stopped. This would be up to the user of the library.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)