[
https://issues.apache.org/activemq/browse/AMQCPP-303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61071#action_61071
]
Martin Carpella commented on AMQCPP-303:
----------------------------------------
I double-checked the cross-compile scripts, yes, it's 3.2.2 and no longer
3.2.1. I'm still trying to get a meaningful backtrace from gdb, but the device
hasn't got enough memory to load all symbol files involved and I'm having
issues with remote GDB and library resolution. As soon as I can get this to
work, I'll post the backtrace.
> SEGFAULT on startup (before main)
> ---------------------------------
>
> Key: AMQCPP-303
> URL: https://issues.apache.org/activemq/browse/AMQCPP-303
> Project: ActiveMQ C++ Client
> Issue Type: Bug
> Components: CMS Impl
> Affects Versions: 3.2.1
> Environment: Linux SMP
> Reporter: Kevin Quick
> Assignee: Timothy Bish
> Priority: Blocker
> Fix For: 3.2.2
>
>
> Application linked with activemq-cpp library crashes on startup before
> reaching main.
> The issue is that static globals are being initialized and calling apr
> library functions during that initialization before apr initialization is
> called (via DecafRuntime()). The DecafRuntime object has a singleton
> initialization pattern which appears to be invoked from
> Runtime::initializeRuntime(), which is invoked from
> ActiveMQCPP::initializeLibrary() in turn from the main routine with stdargs.
> To fix this, static initializers should contrive to call at least
> Runtime::getRuntime() (and possibly other initializers invoked by
> initializeRuntime()) before internally initializing. Alternatively, static
> const elements could be handled via the singleton initialization pattern as
> well such that they aren't initialized until needed... presumably after
> ActiveMQCPP::initializeLibrary() has been invoked in a deterministic manner.
> The offending static initializers in this case are from
> decaf/net/InetAddress.cpp:
> const InetAddress InetAddress::LOOPBACK( Inet4Address( "localhost",
> InetAddress::loopbackBytes, 4 ) );
> const InetAddress InetAddress::ANY( Inet4Address( InetAddress::anyBytes, 4 )
> );
> The corresponding traceback showing this error:
> $ gdb mqtest
> GNU gdb (GDB) 7.0
> ...
> (gdb) b main
> Breakpoint 1 at 0x8085286: file mqtest.cpp line 83
> (gdb) r
> Starting program: mqtest
> [Thread debugging using libthread_db enabled]
> Program received signal SIGSEGV, Segmentation fault.
> 0x08567955 in mutex_hash (mem=0x86c7a64) 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 0x08567955 in mutex_hash (mem=0x86c7a64) at atomic/unix/mutex.c:78
> #1 0x08567984 in apr_atomic_add32 (mem=0x86c7a64, val=4294967295) at
> atomic/unix/mutex.c:113
> #2 0x0814c9a8 in
> decaf::util::concurrent::atomic::AtomicInteger::decrementAndGet
> (this=0x86c7a60) at decaf/util/concurrent/atomic/AtomicInteger.cpp:69
> #3 0x080e3094 in decaf::util::concurrent::atomic::AtomicRefCounter::release
> (this=0xbfffaed4) at ./decaf/util/concurrent/atomic/AtomicRefCounter.h:68
> #4 0x082af1bd in ~ArrayPointer (this=0xbfffaed4, __in_chrg=<value optimized
> out>) at ./decaf/lang/ArrayPointer.h:154
> #5 0x082afbd6 in decaf::lang::ArrayPointer<unsigned char,
> decaf::util::concurrent::atomic::AtomicRefCounter>::reset (this=0xbfffaf7c,
> value=0x86c8400 "\177", size=4)
> at ./decaf/lang/ArrayPointer.h:171
> #6 0x082aec27 in InetAddress (this=0xbfffaf70, hostname=...,
> ipAddress=0x8585c01 "\177", numBytes=4) at decaf/net/InetAddress.cpp:79
> #7 0x084dbf54 in Inet4Address (this=0xbfffaf70, hostname=...,
> ipAddress=0x8585c01 "\177", numBytes=4) at decaf/net/Inet4Address.cpp:34
> #8 0x082adec3 in __static_initialization_and_destruction_0
> (__initialize_p=1, __priority=65535) at decaf/net/InetAddress.cpp:39
> #9 0x082ae005 in global constructors keyed to
> _ZN5decaf3net11InetAddress13loopbackBytesE () at decaf/net/InetAddress.cpp:191
> #10 0x0856b445 in __do_global_ctors_aux ()
> #11 0x080746e5 in _init ()
> #12 0x0856b2d7 in __libc_csu_init ()
> (gdb)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.