You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Mathieu Malaterre <ma...@gmail.com> on 2015/07/15 09:47:04 UTC
Segmentation fault: apr_pool_create_ex
Hi all,
I am trying to understand what is so fundamentally wrong with the following
piece of code (taken from:
https://logging.apache.org/log4cxx/usage.html#Configuration).
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:
https://logging.apache.org/log4cxx/faq.html
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.
Regards.
[*]
Using host libthread_db library "/lib64/libthread_db.so.1".
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/libapr-1.so.0
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/libapr-1.so.0
#1 0x00007ffff7b26b58 in log4cxx::helpers::Pool::Pool() () from
/lib64/liblog4cxx.so.10
#2 0x00007ffff7ae06ea in
log4cxx::helpers::MutexException::formatMessage(int) () from
/lib64/liblog4cxx.so.10
#3 0x00007ffff7ae0786 in
log4cxx::helpers::MutexException::MutexException(int) () from
/lib64/liblog4cxx.so.10
#4 0x00007ffff7b4a310 in
log4cxx::helpers::synchronized::synchronized(log4cxx::helpers::Mutex
const&) () from /lib64/liblog4cxx.so.10
#5 0x00007ffff7b5d9c8 in log4cxx::WriterAppender::close() () from
/lib64/liblog4cxx.so.10
#6 0x00007ffff7ac979c in log4cxx::ConsoleAppender::~ConsoleAppender() ()
from /lib64/liblog4cxx.so.10
#7 0x00007ffff7ac98b9 in log4cxx::ConsoleAppender::~ConsoleAppender() ()
from /lib64/liblog4cxx.so.10
#8 0x00007ffff7aba247 in
log4cxx::helpers::AppenderAttachableImpl::~AppenderAttachableImpl() () from
/lib64/liblog4cxx.so.10
#9 0x00007ffff7b0494c in log4cxx::Logger::~Logger() () from
/lib64/liblog4cxx.so.10
#10 0x00007ffff7b388b4 in log4cxx::spi::RootLogger::~RootLogger() () from
/lib64/liblog4cxx.so.10
#11 0x00007ffff7b0429a in log4cxx::Logger::~Logger() () from
/lib64/liblog4cxx.so.10
#12 0x00007ffff7b04429 in log4cxx::Logger::~Logger() () from
/lib64/liblog4cxx.so.10
#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/libc.so.6
#15 0x00007ffff6e383e5 in exit () from /lib64/libc.so.6
#16 0x00007ffff6e1efe7 in __libc_start_main () from /lib64/libc.so.6
#17 0x0000000000401319 in _start ()
--
Mathieu
Re: Segmentation fault: apr_pool_create_ex
Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Mathieu Malaterre,
am Mittwoch, 15. Juli 2015 um 09:47 schrieben Sie:
> Here is the crash I get [*].
I'm pretty sure I can't help you in detail, not enough C++ knowledge
as well, but there are quite some bugs filed already against Log4cxx
dealing with crashes especially in multithreaded environments.
Additionally, if I understand your file names correctly, you are using
version 0.10 of the lib? If that's the case try to use the current
trunk, there were a lot of bugfixes applied already.
https://issues.apache.org/jira/browse/LOGCXX-322
https://issues.apache.org/jira/browse/LOGCXX-389?jql=project%20%3D%20LOGCXX%20AND%20resolution%20%3D%20Unresolved%20AND%20text%20~%20"crash"%20ORDER%20BY%20priority%20DESC
Mit freundlichen Grüßen,
Thorsten Schöning
--
Thorsten Schöning E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/
Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow