SEGFAULT on shutdown
--------------------
Key: AMQCPP-304
URL: https://issues.apache.org/activemq/browse/AMQCPP-304
Project: ActiveMQ C++ Client
Issue Type: Bug
Components: CMS Impl
Affects Versions: 3.2.1
Environment: Linux
Reporter: Kevin Quick
Assignee: Timothy Bish
If application does not initialize (or use) ActiveMQ-CPP before exiting, global
static elements will call apr functionality without initialization of same,
resulting in a segfault.
Similar issue to AMQCPP-303. This global static element is:
activemq/commands/ActiveMQDestination.cpp:
...
util::ActiveMQProperties options;
Test file (mqtest.cpp):
#include <iostream>
// Normally comes from library include: explicit here facilitate problem
demonstration
#include <activemq/commands/ActiveMQDestination.cpp>
int main(int, char**)
{
std::cout << "Hello" << std::endl;
}
To reproduce:
$ gdb mqtest
...
(gdb) r
Starting program:
/Mount/Work/per_mbus/persephone_trunk/pjs/nexus_handlers/mbus/mqtest
[Thread debugging using libthread_db enabled]
Hello
Program received signal SIGSEGV, Segmentation fault.
0x080c0835 in mutex_hash (mem=0x80e386c) at atomic/unix/mutex.c:78
78 apr_thread_mutex_t *mutex = hash_mutex[ATOMIC_HASH(mem)];
Current language: auto
The current source language is "auto; currently c".
(gdb) bt
#0 0x080c0835 in mutex_hash (mem=0x80e386c) at atomic/unix/mutex.c:78
#1 0x080c0864 in apr_atomic_add32 (mem=0x80e386c, val=4294967295) at
atomic/unix/mutex.c:113
#2 0x0808630c in
decaf::util::concurrent::atomic::AtomicInteger::decrementAndGet
(this=0x80e3868) at decaf/util/concurrent/atomic/AtomicInteger.cpp:69
#3 0x08056e86 in decaf::util::concurrent::atomic::AtomicRefCounter::release
(this=0x80e285c)
at
/Files/Compile/Sources/activemq-cpp-library-3.2.1/src/main/decaf/util/concurrent/atomic/AtomicRefCounter.h:68
#4 0x0808450d in ~Pointer (this=0x80e285c, __in_chrg=<value optimized out>) at
./decaf/lang/Pointer.h:143
#5 0x0808151e in ~Properties (this=0x80e2854, __in_chrg=<value optimized out>)
at decaf/util/Properties.cpp:133
#6 0x0805cae1 in ~ActiveMQProperties (this=0x80e2850, __in_chrg=<value
optimized out>) at activemq/util/ActiveMQProperties.cpp:31
#7 0x08054c00 in __tcf_17 () at
/Files/Compile/Sources/activemq-cpp-library-3.2.1/src/main/activemq/commands/ActiveMQDestination.cpp:59
#8 0xb7b2b529 in exit () from /System/Links/Libraries/libc.so.6
(gdb)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.