activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Bish (JIRA)" <>
Subject [jira] Commented: (AMQCPP-327) SEGFAULT on shutdown with global variable AMQCPP references
Date Tue, 09 Nov 2010 21:25:00 GMT


Timothy Bish commented on AMQCPP-327:

The example is not a valid use of the library.  All library resources must be terminated prior
to the exit of the main method, also a clean shutdown would not be guaranteed unless the shutdownLibrary
method is also called in main.

See the provided examples for a better demonstration of the usage pattern for AMQCPP.


int main(int argc, char** argv)
  amqmgr = std::auto_ptr<mgr>(new mgr("tcp://msg1.shared.dev1:61616"));


> SEGFAULT on shutdown with global variable AMQCPP references
> -----------------------------------------------------------
>                 Key: AMQCPP-327
>                 URL:
>             Project: ActiveMQ C++ Client
>          Issue Type: Bug
>          Components: CMS Impl
>    Affects Versions: 3.2.1
>         Environment: CentOS
>            Reporter: Kevin Quick
>            Assignee: Timothy Bish
>            Priority: Minor
>         Attachments: mbtest.cpp
> If AMQ-CPP resources are managed by global variables and those global variables are not
explicitly shutdown, the post-exit shutdown code ordering usually causes a segfault.  This
is because the AMQ-CPP internal threads shutdown the apr library first and then the global
variables attempt to close() their connections which result in apr calls.
> A simple program to demonstrate this is attached; when run it results in the segfault
core trace:
> Program received signal SIGSEGV, Segmentation fault.
> 0xb72f72fe in mutex_hash (mem=0x806089c) at atomic/unix/mutex.c:78
> 78	atomic/unix/mutex.c: No such file or directory.
> 	in atomic/unix/mutex.c
> (gdb) bt
> #0  0xb72f72fe in mutex_hash (mem=0x806089c) at atomic/unix/mutex.c:78
> #1  0xb72f7457 in apr_atomic_cas32 (mem=0x806089c, with=0, cmp=1) at atomic/unix/mutex.c:152
> #2  0xb7e35bca in decaf::util::concurrent::atomic::AtomicBoolean::compareAndSet (
>     this=0x8060898, expect=true, update=false)
>     at decaf/util/concurrent/atomic/AtomicBoolean.cpp:42
> #3  0xb7a51238 in activemq::core::ActiveMQConnection::stop (this=0x8060880)
>     at activemq/core/ActiveMQConnection.cpp:425
> #4  0xb7a56ad0 in activemq::core::ActiveMQConnection::close (this=0x8060880)
>     at activemq/core/ActiveMQConnection.cpp:355
> #5  0x08048adc in mgr::~mgr() ()
> #6  0x08048b6b in std::auto_ptr<mgr>::~auto_ptr() ()
> #7  0x08048974 in __tcf_1 ()
> #8  0xb7346529 in exit () from /System/Links/Libraries/
> Note: possibly related to AMQCPP-231.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message