Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 1701 invoked from network); 6 Aug 2010 06:27:16 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 Aug 2010 06:27:16 -0000 Received: (qmail 83473 invoked by uid 500); 6 Aug 2010 06:27:16 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 83270 invoked by uid 500); 6 Aug 2010 06:27:14 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 83262 invoked by uid 99); 6 Aug 2010 06:27:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Aug 2010 06:27:12 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Aug 2010 06:27:10 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o766Qmoi002023 for ; Fri, 6 Aug 2010 06:26:49 GMT Message-ID: <17728691.141281076008849.JavaMail.jira@thor> Date: Fri, 6 Aug 2010 02:26:48 -0400 (EDT) From: "Martin Carpella (JIRA)" To: dev@activemq.apache.org Subject: [jira] Commented: (AMQCPP-303) SEGFAULT on startup (before main) In-Reply-To: <288014.43731279292811797.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: ae95407df07c98740808b2ef9da0087c X-Virus-Checked: Checked by ClamAV on apache.org [ 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=) at ./decaf/lang/ArrayPointer.h:154 > #5 0x082afbd6 in decaf::lang::ArrayPointer::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.