Curt Arnold wrote:
It always helps if you can specify the compiler and operating system
and a stack trace would also be nice.
* Debian Lenny (x86)
* Linux 2.6.25
* GLIBC v2.7
* GCC 4.3.1
* APR 1.3.3 (self-compiled)
* APR-util 1.3.4 (self-compiled)

Backtrace:

#0  0xb7aadaf4 in mutex_hash (mem=0x909bd2c) at atomic/unix/mutex.c:78
#1 0xb7aadbfc in apr_atomic_dec32 (mem=0x909bd2c) at atomic/unix/mutex.c:138 #2 0xb7eeedd4 in log4cxx::helpers::ObjectImpl::releaseRef (this=0x909bd28) at objectimpl.cpp:44 #3 0xb7ed7c7c in log4cxx::Logger::releaseRef (this=0x909bcf0) at logger.cpp:62 #4 0x08049489 in ~ObjectPtrT (this=0x804acf4) at .../include/log4cxx/helpers/objectptr.h:100
#5  0xb7c16ab9 in exit () from /lib/i686/cmov/libc.so.6
#6  0xb7bfe45d in __libc_start_main () from /lib/i686/cmov/libc.so.6
#7  0x08049081 in _start ()

One likely possibility is that APR may have already shut down. Calling apr after a call to apr_terminate would likely seg fault. If you have the ability to debug, setting a break point on the atexit and apr_terminate and seeing which gets called first and what triggers the apr_terminate would be helpful.
$ gdb ./crash
(gdb) break cleanup
Breakpoint 1 at 0x8049203: file crash.cpp, line 8.
(gdb) break apr_terminate
Function "apr_terminate" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 2 (apr_terminate) pending.
(gdb) r
Starting program: /home/mma/l4c/custom/crash
[Thread debugging using libthread_db enabled]
[New Thread 0xb79f0910 (LWP 1430)]
[Switching to Thread 0xb79f0910 (LWP 1430)]

Breakpoint 1, cleanup () at crash.cpp:8
8               LOG4CXX_DEBUG(log, "Oops...");
(gdb) c
Continuing.
979 [0xb79f0910] DEBUG main null - Oops...

Breakpoint 2, apr_terminate () at misc/unix/start.c:78
78          initialized--;
Current language:  auto; currently c
(gdb) bt
#0  apr_terminate () at misc/unix/start.c:78
#1 0xb7e5d82b in ~APRInitializer (this=0xb7fa15f8) at aprinitializer.cpp:52
#2  0xb7c04ab9 in exit () from /lib/i686/cmov/libc.so.6
#3  0xb7bec45d in __libc_start_main () from /lib/i686/cmov/libc.so.6
#4  0x08049081 in _start ()
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0xb7a9baf4 in mutex_hash (mem=0x92e8d2c) at atomic/unix/mutex.c:78
78          apr_thread_mutex_t *mutex = hash_mutex[ATOMIC_HASH(mem)];
(gdb)

Reply via email to