activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <tabish...@gmail.com>
Subject Re: Segmentation fault with AMQCPP 2.2.4
Date Thu, 12 Mar 2009 12:34:13 GMT
On Thu, 2009-03-12 at 03:41 -0700, Sebastien SOILEN wrote:
> Hello,
> 
> 
> I'm using ActiveMQ 5.2.0 and amqcpp 2.2.4
> 
> I get occasional segmentation fault with a small broker monitor I wrote.
> Here is the monitor:
> 
> 
> #include <activemq/core/ActiveMQConnectionFactory.h>
> #include <cms/Connection.h>
> 
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> 
> 
> using namespace activemq::core;
> using namespace cms;
> using namespace std;
> 
> const char * C_szDefStr =
> "tcp://127.0.0.1:61616?connection.closeTimeout=1000&connection.sendTimeout=5000&connection.socketBufferSize=128*1024";
> 
> int main(int argc, const char ** argv)
> {
> 	Connection * pConn = NULL;
> 	int result = 0;
> 
>     try {
> 		std::string brokerURI = (argc>1) ? argv[1] : C_szDefStr;
> 
> 		// ActiveMQ connection sequence
> 		ActiveMQConnectionFactory* pFactory = new ActiveMQConnectionFactory(
> brokerURI );
> 		pConn = pFactory->createConnection();
> 
> 		delete pFactory, pFactory = NULL; // We don't need this one any longer
> 
> 		if (!pConn)	return 1; // Failed to create connection
> 
> 		pConn->start();
> 		pConn->stop();
> 
>     } catch (CMSException& e) {
> 		// This error usually means that ActiveMQ is not running
> 		printf("Erreur de connexion\n") ;
> 		// Mark as error
> 		result = 1;
>     }
> 
>     // Try to delete, even if an exception was caught
> 	delete pConn, pConn = NULL;
> 
>     return result;
> }
> 
> 
> I got two differents segmentation faults, here are the traces:
> 
> Program terminated with signal 11, Segmentation fault.
> #0  apr_palloc (pool=0x0, size=28) at memory/unix/apr_pools.c:638
> 638	    active = pool->active;
> (gdb) bt
> #0  apr_palloc (pool=0x0, size=28) at memory/unix/apr_pools.c:638
> #1  0x0030e92f in apr_thread_mutex_create (mutex=0x9577fb4, flags=1,
> pool=0x0) at locks/unix/thread_mutex.c:50
> #2  0x01260a98 in Mutex (this=0x9577fa8) at
> decaf/util/concurrent/Mutex.cpp:31
> #3  0x0125e781 in ByteArrayOutputStream (this=0x9577f90) at
> decaf/io/ByteArrayOutputStream.cpp:28
> #4  0x011c16f1 in activemq::connector::openwire::OpenWireFormat::marshal
> (this=0x964e858, command=0xb70f1074, 
>     dataOut=0x9655268) at activemq/connector/openwire/OpenWireFormat.cpp:192
> #5  0x011c7538 in
> activemq::connector::openwire::OpenWireCommandWriter::writeCommand
> (this=0x962506c, command=0xb70f1074)
>     at activemq/connector/openwire/OpenWireCommandWriter.cpp:71
> #6  0x011f61f7 in activemq::transport::IOTransport::oneway (this=0x952f1c8,
> command=0xb70f1074)
>     at activemq/transport/IOTransport.cpp:91
> #7  0x011f4877 in activemq::transport::TransportFilter::oneway
> (this=0x952f1f8, command=0xb70f1074)
>     at activemq/transport/TransportFilter.h:131
> #8  0x011fa748 in activemq::transport::filters::ResponseCorrelator::oneway
> (this=0x9510d28, command=0xb70f1074)
>     at activemq/transport/filters/ResponseCorrelator.cpp:59
> #9  0x011c8ff3 in
> activemq::connector::openwire::OpenWireFormatNegotiator::oneway
> (this=0x964f040, command=0xb70f1074)
>     at activemq/connector/openwire/OpenWireFormatNegotiator.cpp:75
> #10 0x011c9d72 in activemq::connector::openwire::OpenWireConnector::oneway
> (this=0x9624fe0, command=0xb70f1074)
>     at activemq/connector/openwire/OpenWireConnector.cpp:1495
> #11 0x011cb560 in
> activemq::connector::openwire::OpenWireConnector::acknowledge
> (this=0x9624fe0, session=0x965f9f8, 
>     consumer=0x96607f0, message=0x96a64e0, ackType=<value optimized out>)
>     at activemq/connector/openwire/OpenWireConnector.cpp:916
> #12 0x01158ded in activemq::core::ActiveMQConsumer::acknowledge
> (this=0x9660828, message=0x96a6598, ackType=2)
>     at activemq/core/ActiveMQConsumer.cpp:458
> #13 0x0115925c in activemq::core::ActiveMQConsumer::afterMessageIsConsumed
> (this=0x9660828, message=0x96a6598, 
>     messageExpired=false) at activemq/core/ActiveMQConsumer.cpp:408
> #14 0x0115a01f in activemq::core::ActiveMQConsumer::dispatch
> (this=0x9660828, data=@0x96a69f0)
>     at activemq/core/ActiveMQConsumer.cpp:492
> #15 0x011731d5 in activemq::core::ActiveMQSessionExecutor::dispatch
> (this=0x965fcc8, data=@0x96a69f0)
>     at activemq/core/ActiveMQSessionExecutor.cpp:185
> #16 0x01174801 in activemq::core::ActiveMQSessionExecutor::dispatchAll
> (this=0x965fcc8)
>     at activemq/core/ActiveMQSessionExecutor.cpp:266
> #17 0x01174e2f in activemq::core::ActiveMQSessionExecutor::run
> (this=0x965fcc8)
>     at activemq/core/ActiveMQSessionExecutor.cpp:208
> #18 0x0124a1b8 in decaf::lang::Thread::runCallback (self=0x95c90e0,
> param=0x9660798) at decaf/lang/Thread.cpp:125
> #19 0x00319736 in dummy_worker (opaque=0x95c90e0) at
> threadproc/unix/thread.c:142
> #20 0x00ba745b in start_thread () from /lib/libpthread.so.0
> #21 0x00afec4e in clone () from /lib/libc.so.6
> 
> 
> the second one:
> 
> Program terminated with signal 11, Segmentation fault.
> #0  0x004d2bf7 in apr_atomic_add32 (mem=0x87c8d4c, val=1) at
> atomic/unix/mutex.c:78
> 78	    apr_thread_mutex_t *mutex = hash_mutex[ATOMIC_HASH(mem)];
> (gdb) bt
> #0  0x004d2bf7 in apr_atomic_add32 (mem=0x87c8d4c, val=1) at
> atomic/unix/mutex.c:78
> #1  0x004d2c65 in apr_atomic_inc32 (mem=0x87c8d4c) at
> atomic/unix/mutex.c:132
> #2  0x0121b460 in
> decaf::util::concurrent::atomic::AtomicInteger::getAndIncrement
> (this=0x87c8d48)
>     at decaf/util/concurrent/atomic/AtomicInteger.cpp:54
> #3  0x011ae713 in activemq::transport::filters::ResponseCorrelator::oneway
> (this=0x87c8d28, command=0xb7139074)
>     at activemq/transport/filters/ResponseCorrelator.cpp:51
> #4  0x0117cff3 in
> activemq::connector::openwire::OpenWireFormatNegotiator::oneway
> (this=0x8907040, command=0xb7139074)
>     at activemq/connector/openwire/OpenWireFormatNegotiator.cpp:75
> #5  0x0117dd72 in activemq::connector::openwire::OpenWireConnector::oneway
> (this=0x88dcfe0, command=0xb7139074)
>     at activemq/connector/openwire/OpenWireConnector.cpp:1495
> #6  0x0117f560 in
> activemq::connector::openwire::OpenWireConnector::acknowledge
> (this=0x88dcfe0, session=0x89179f8, 
>     consumer=0x8918800, message=0x895e520, ackType=<value optimized out>)
>     at activemq/connector/openwire/OpenWireConnector.cpp:916
> #7  0x0110cded in activemq::core::ActiveMQConsumer::acknowledge
> (this=0x8918838, message=0x895e5d8, ackType=2)
>     at activemq/core/ActiveMQConsumer.cpp:458
> #8  0x0110d25c in activemq::core::ActiveMQConsumer::afterMessageIsConsumed
> (this=0x8918838, message=0x895e5d8, 
>     messageExpired=false) at activemq/core/ActiveMQConsumer.cpp:408
> #9  0x0110e01f in activemq::core::ActiveMQConsumer::dispatch
> (this=0x8918838, data=@0x88d8918)
>     at activemq/core/ActiveMQConsumer.cpp:492
> #10 0x011271d5 in activemq::core::ActiveMQSessionExecutor::dispatch
> (this=0x8917cd8, data=@0x88d8918)
>     at activemq/core/ActiveMQSessionExecutor.cpp:185
> #11 0x01128801 in activemq::core::ActiveMQSessionExecutor::dispatchAll
> (this=0x8917cd8)
>     at activemq/core/ActiveMQSessionExecutor.cpp:266
> #12 0x01128e2f in activemq::core::ActiveMQSessionExecutor::run
> (this=0x8917cd8)
>     at activemq/core/ActiveMQSessionExecutor.cpp:208
> #13 0x011fe1b8 in decaf::lang::Thread::runCallback (self=0x88810e0,
> param=0x89186e8) at decaf/lang/Thread.cpp:125
> #14 0x004d0736 in dummy_worker (opaque=0x88810e0) at
> threadproc/unix/thread.c:142
> #15 0x00ba745b in start_thread () from /lib/libpthread.so.0
> #16 0x00afec4e in clone () from /lib/libc.so.6
> 
> 
> The segmentation faults occur in the apr code, but I suppose this would be
> related to an activemq-cpp error.
> Should I open an issue or is this a known problem?
> 
> Thank you. Regards,
> 
> Sebastien SOILEN
> 

Yes, you should open a Jira issue and attach any relavent code to
reproduce the problem along with full stack trace dumps from gdb or the
debugger of your choice.  The code runs at least three threads once you
start the connection so having a backtrace of all threads and not just
the main thread would help to determine that source of the error.

Regards
Tim.

-- 
Tim Bish
http://fusesource.com
http://timbish.blogspot.com/




Mime
View raw message