Segmentation fault: apr_pool_create_ex

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Segmentation fault: apr_pool_create_ex

Mathieu Malaterre
Hi all,

I am trying to understand what is so fundamentally wrong with the following piece of code (taken from:

If I compile it with (see attached file):

$ g++ -g -o logger log4cxx_crash.cpp -llog4cxx

Here is the crash I get [*]. I did check that this is a different crash from the one explained in the FAQ:

I've simply moved the initialisation from outside `main()` function to inside `main()` function. I fail to understand why the order of initialisation is so important (I could not find anything relevant in the documentation).

Thanks for comments, my c++ knowledge would need a refresher.


Using host libthread_db library "/lib64/".
0 [0x7ffff7fb0780] INFO MyApp null - Entering application.
3 [0x7ffff7fb0780] INFO MyApp null - Exiting application.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5f69dc9 in apr_pool_create_ex () from /lib64/
Missing separate debuginfos, use: debuginfo-install apr-1.5.1-3.fc21.x86_64 apr-util-1.5.4-1.fc21.x86_64 cyrus-sasl-lib-2.1.26-19.fc21.x86_64 expat-2.1.0-10.fc21.x86_64 libdb-5.3.28-9.fc21.x86_64 libgcc-4.9.2-6.fc21.x86_64 libstdc++-4.9.2-6.fc21.x86_64 libuuid-2.25.2-3.fc21.x86_64 log4cxx-0.10.0-17.fc21.x86_64 nspr-4.10.8-1.fc21.x86_64 nss-3.19.1-1.0.fc21.x86_64 nss-softokn-freebl-3.19.1-1.0.fc21.x86_64 nss-util-3.19.1-1.0.fc21.x86_64 openldap-2.4.40-3.fc21.x86_64 zlib-1.2.8-7.fc21.x86_64
(gdb) bt
#0  0x00007ffff5f69dc9 in apr_pool_create_ex () from /lib64/
#1  0x00007ffff7b26b58 in log4cxx::helpers::Pool::Pool() () from /lib64/
#2  0x00007ffff7ae06ea in log4cxx::helpers::MutexException::formatMessage(int) () from /lib64/
#3  0x00007ffff7ae0786 in log4cxx::helpers::MutexException::MutexException(int) () from /lib64/
#4  0x00007ffff7b4a310 in log4cxx::helpers::synchronized::synchronized(log4cxx::helpers::Mutex const&) () from /lib64/
#5  0x00007ffff7b5d9c8 in log4cxx::WriterAppender::close() () from /lib64/
#6  0x00007ffff7ac979c in log4cxx::ConsoleAppender::~ConsoleAppender() () from /lib64/
#7  0x00007ffff7ac98b9 in log4cxx::ConsoleAppender::~ConsoleAppender() () from /lib64/
#8  0x00007ffff7aba247 in log4cxx::helpers::AppenderAttachableImpl::~AppenderAttachableImpl() () from /lib64/
#9  0x00007ffff7b0494c in log4cxx::Logger::~Logger() () from /lib64/
#10 0x00007ffff7b388b4 in log4cxx::spi::RootLogger::~RootLogger() () from /lib64/
#11 0x00007ffff7b0429a in log4cxx::Logger::~Logger() () from /lib64/
#12 0x00007ffff7b04429 in log4cxx::Logger::~Logger() () from /lib64/
#13 0x00000000004017c4 in log4cxx::helpers::ObjectPtrT<log4cxx::Logger>::~ObjectPtrT (this=0x6031a0 <logger>, __in_chrg=<optimized out>) at /usr/include/log4cxx/helpers/objectptr.h:100
#14 0x00007ffff6e38392 in __run_exit_handlers () from /lib64/
#15 0x00007ffff6e383e5 in exit () from /lib64/
#16 0x00007ffff6e1efe7 in __libc_start_main () from /lib64/
#17 0x0000000000401319 in _start ()


log4cxx_crash.cpp (832 bytes) Download Attachment