vanand123 opened a new issue, #545:
URL: https://github.com/apache/logging-log4cxx/issues/545
Log4cxx 0.13.0 introduced a critical thread safety change that causes
applications to crash with SIGSEGV during startup when multiple threads
concurrently access `Logger::getLogger()`. The issue is caused by commit
`6505a08671b4c564f9fb5b237c856c52c126307d` which replaced thread-safe
`LoggerRepositoryWeakPtr` with unsafe raw `LoggerRepository*` pointers.
### Environment Details:
- **Log4cxx Version**: 0.13.0
- **Platform**: Linux x86_64
- **Compiler**: GCC 7.5.0, C++14
- **Threading**: Multi-threaded application with concurrent logger access
- **APR Version**: 1.7.4
- **APR-Util Version**: 1.6.3
### Problematic Commit:
- **Commit Hash**: `6505a08671b4c564f9fb5b237c856c52c126307d`
- **Title**: "[LOGCXX-546] Prevent serialization of a multi-threaded
application when using disabled logging statements"
- **Author**: Stephen Webb
- **Date**: January 1, 2022
### Sample Code:
```
log4cxx::LoggerPtr testlog_control::getTestLoggerFromModuleName( const
std::string &module ) const
{
log4cxx::LoggerPtr logger = ( module==rootModuleName ? _rootLogger :
log4cxx::Logger::getLogger( module ) );
assert(logger);
return logger;
}
```
### Observed Crash:
```
#0 read () from /lib64/libc.so.6
#1 sig_handler_bt_exit (sig=11, pSigInfo=0x7ffcc897df70,
pContext=0x7ffcc897de40) at /include/bits/unistd.h:38
#2 <signal handler called>
#3 log4cxx::LogManager::getLoggerLS(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&) () from
/lib64/liblog4cxx.so.13
#4 log4cxx::LogManager::getLogger(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&) () from
/lib64/liblog4cxx.so.13
#5 log4cxx::Logger::getLogger(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&) () from
/lib64/liblog4cxx.so.13
#6 testlog::testlog_control::getTestLoggerFromModuleName (this=<optimized
out>, module=...) at testlog_control.cpp:268
#7 testlog::testlog_control::getTestLogLevel (this=<optimized out>,
module=...) at testlog_control.cpp:299
#8 testlog::testlog_control::testlog_control (this=<optimized out>,
ident=<optimized out>, logfilename=<optimized out>) at testlog_control.cpp:88
#9 initTestLog (ident=<optimized out>, logfilename=<optimized out>) at
testlog_control.cpp:746
#10 applstrtTaskEntry (argv=<optimized out>) at applstrt.cpp:419
#11 main (argc=<optimized out>, argv=<optimized out>) at applstrt.cpp:848
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]