apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastien SOILEN <sebastien.soi...@gtd.es>
Subject segmentation fault in apr_atomic_add32
Date Wed, 04 Feb 2009 10:41:55 GMT
Hello,

I got an segmentation error using activemq-cpp-2.2.3 compiled with 
apr-1.3.3 and apr-util-1.3.4. The backtrace shows a problem with the 
apr_atomic_add32 function:

    Program terminated with signal 11, Segmentation fault.
    #0  0x00242367 in apr_atomic_add32 (mem=0x9001e4c, val=1) at
    atomic/unix/mutex.c:78
    78          apr_thread_mutex_t *mutex = hash_mutex[ATOMIC_HASH(mem)];
    (gdb) bt
    #0  0x00242367 in apr_atomic_add32 (mem=0x9001e4c, val=1) at
    atomic/unix/mutex.c:78
    #1  0x002423d5 in apr_atomic_inc32 (mem=0x9001e4c) at
    atomic/unix/mutex.c:132
    #2  0x01238f60 in
    decaf::util::concurrent::atomic::AtomicInteger::getAndIncrement
    (this=0x9001e48) at decaf/util/concurrent/atomic/AtomicInteger.cpp:54
    #3  0x011cc3b3 in
    activemq::transport::filters::ResponseCorrelator::oneway
    (this=0x9001e28, command=0xb70f2074) at
    activemq/transport/filters/ResponseCorrelator.cpp:51
    #4  0x0119ae93 in
    activemq::connector::openwire::OpenWireFormatNegotiator::oneway
    (this=0x9047d50, command=0xb70f2074) at
    activemq/connector/openwire/OpenWireFormatNegotiator.cpp:75
    #5  0x0119b8c2 in
    activemq::connector::openwire::OpenWireConnector::oneway
    (this=0x9032da0, command=0xb70f2074) at
    activemq/connector/openwire/OpenWireConnector.cpp:1495
    #6  0x0119ccf0 in
    activemq::connector::openwire::OpenWireConnector::acknowledge
    (this=0x9032da0, session=0x9054148, consumer=0x90554d8,
    message=0x90991c0, ackType=<value optimized out>)
        at activemq/connector/openwire/OpenWireConnector.cpp:916
    #7  0x0112ad8d in activemq::core::ActiveMQConsumer::acknowledge
    (this=0x9055510, message=0x9099278, ackType=2) at
    activemq/core/ActiveMQConsumer.cpp:458
    #8  0x0112b1fc in
    activemq::core::ActiveMQConsumer::afterMessageIsConsumed
    (this=0x9055510, message=0x9099278, messageExpired=false) at
    activemq/core/ActiveMQConsumer.cpp:408
    #9  0x0112bfbf in activemq::core::ActiveMQConsumer::dispatch
    (this=0x9055510, data=@0x9098f68) at
    activemq/core/ActiveMQConsumer.cpp:492
    #10 0x011450e5 in activemq::core::ActiveMQSessionExecutor::dispatch
    (this=0x90546d8, data=@0x9098f68) at
    activemq/core/ActiveMQSessionExecutor.cpp:185
    #11 0x01146711 in
    activemq::core::ActiveMQSessionExecutor::dispatchAll
    (this=0x90546d8) at activemq/core/ActiveMQSessionExecutor.cpp:266
    #12 0x01146d3f in activemq::core::ActiveMQSessionExecutor::run
    (this=0x90546d8) at activemq/core/ActiveMQSessionExecutor.cpp:208
    #13 0x0121bdb8 in decaf::lang::Thread::runCallback (self=0x8fc7b58,
    param=0x90554a8) at decaf/lang/Thread.cpp:125
    #14 0x0023fa26 in dummy_worker (opaque=0x8fc7b58) at
    threadproc/unix/thread.c:142
    #15 0x00a1945b in start_thread () from /lib/libpthread.so.0
    #16 0x00970c4e in clone () from /lib/libc.so.6

I reproduced the error with a simple test :

    #include <stdio.h>
    #include <apr_atomic.h>

    int main(void)
    {
       apr_uint32_t val;
       apr_atomic_set32(&val, 23);
       printf("result: %d", apr_atomic_inc32(&val));
    }

obtaining this stack trace:


    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread -1208088832 (LWP 21121)]
    0x00dc94c7 in apr_atomic_set32 (mem=0xbfe2d880, val=23) at
    atomic/unix/mutex.c:78
    78          apr_thread_mutex_t *mutex = hash_mutex[ATOMIC_HASH(mem)];
    (gdb) bt
    #0  0x00dc94c7 in apr_atomic_set32 (mem=0xbfe2d880, val=23) at
    atomic/unix/mutex.c:78
    #1  0x08048608 in main ()

In this case, this is the call to apr_atomic_set32 that caused the 
segfault. I reproduced it too with the test function from the test suite 
provided on the svn repository.
Any clue? Any need for more information or more tests?

Regards,

Sebastien SOILEN





Mime
View raw message