You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Kevin Quick (JIRA)" <ji...@apache.org> on 2010/07/16 17:06:51 UTC

[jira] Created: (AMQCPP-303) SEGFAULT on startup (before main)

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


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.


[jira] Commented: (AMQCPP-303) SEGFAULT on startup (before main)

Posted by "Martin Carpella (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQCPP-303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61035#action_61035 ] 

Martin Carpella commented on AMQCPP-303:
----------------------------------------

I'm still experiencing this issue on an ARM cross-compiled application that works fine with ActiveMQ-CPP 3.1.3. I'm having problems getting gdb running on the device, so I'm unable to provide a backtrace right now. I'm on it.

> 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.


[jira] Commented: (AMQCPP-303) SEGFAULT on startup (before main)

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQCPP-303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61881#action_61881 ] 

Timothy Bish commented on AMQCPP-303:
-------------------------------------

Actually we are at v3.2.3: Always check this page, http://activemq.apache.org/cms/download.html

The news items on the Apache site don't always update unfortunately.

> 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.


[jira] Commented: (AMQCPP-303) SEGFAULT on startup (before main)

Posted by "John Rocha (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQCPP-303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61882#action_61882 ] 

John Rocha commented on AMQCPP-303:
-----------------------------------

Excellent. Thanks for the update!

> 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.


[jira] Commented: (AMQCPP-303) SEGFAULT on startup (before main)

Posted by "John Rocha (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQCPP-303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61880#action_61880 ] 

John Rocha commented on AMQCPP-303:
-----------------------------------

I see that this is resolved in 3.2.2, but it appears that 3.2.2 hasn't been released yet? At least not according to the page http://activemq.apache.org/cms/ which shows 3.2.1 as the latest released version.

Is there an ETA when 3.2.2 will be released?

If not, or its not for awhile, would it be possible to get patch information for this specific fix?

Thanks in advance for your help.

-=John Rocha

> 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.


[jira] Resolved: (AMQCPP-303) SEGFAULT on startup (before main)

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQCPP-303?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish resolved AMQCPP-303.
---------------------------------

    Resolution: Fixed

Fixed in trunk and the 3.2.x fixes branch

> 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.


[jira] Updated: (AMQCPP-303) SEGFAULT on startup (before main)

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQCPP-303?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish updated AMQCPP-303:
--------------------------------

    Fix Version/s: 3.2.2

Good find, forgot those were even there.

> 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.


[jira] Commented: (AMQCPP-303) SEGFAULT on startup (before main)

Posted by "Martin Carpella (JIRA)" <ji...@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=<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.


[jira] Commented: (AMQCPP-303) SEGFAULT on startup (before main)

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQCPP-303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=61070#action_61070 ] 

Timothy Bish commented on AMQCPP-303:
-------------------------------------

have you tried the 3.2.2 release?

> 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.