activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gavin123 <gavinn...@yahoo.com>
Subject ActiveMQ-CPP client crashes creating producers thru a broken ethernet link with ActiveMQ Message Broker
Date Fri, 02 Nov 2007 22:45:23 GMT

I am writing a ActiveMQ-Cpp client using ActiveMQ-CPP version 2.1; This
client application runs on Linux  machine (Linux version 2.6.12-1.1381_FC3)
An ActiveMQ Message Broker( version 4.2 ) process runs on another linux
machine. 

If my application tries to create a producer while the ethernet connection
between my client machine and the message broker machine disconnected, then
I my client application crashes with the following error message:

//begin error message
Segmentation fault
//end error message

Running gdb debugger on my client application, I see the following error:

//begin gdb error message
Program received signal SIGSEGV, Segmentation fault.
0x009bad3c in
activemq::connector::openwire::OpenWireConnector::createProducer (
    this=0x83ead30, destination=0x83ec328, session=0x83ebf10)
    at activemq/connector/openwire/OpenWireConnector.cpp:752
752             delete producerInfo;
//end gdb error message

Inside  activemq::connector::openwire::OpenWireConnector::creatProducer()
function, I notice these following lines of codes:
//inside the function OpenWireConnector::createProducer()
        ProducerInfo* OpenWireConnector::createProducer(
          const cms::Destination* destination,
          connector::SessionInfo* session )
          throw ( ConnectorException )
       {  ...
706:       producer = new OpenWireProducerInfo( this );
          ...
709:       producerInfo = new commands::ProducerInfo();
710:       producer->setProducerInfo( producerInfo );
          ...
750:      }catch( ConnectorException& ex ) {
751:       delete producer;
752:       delete producerInfo;
          ...
        }
//end of createProducer() 
line 710: inits the producer internal pointer to producerInfo pointer.
when an exception is caught, line 751: delete the producer which will call
OpenWireProducerInfo destructor, which in turns deletes the producer
internal pointer. This will deallocate the memory that producerInfo pointer
is pointing to. This causes line 752: delete producerInfo crash the
application with error "Segmentation Fault"

Take a look at OpenWireProducerInfo destructor
//inside OpenWireProducerInfo.h
virtual ~OpenWireProducerInfo() { 
            this->close();
            delete producerInfo; 
        }
//end destructor

Should we have to delete producerInfo?

Does anybody know of a fix that doesn't affect other classes?

Thanks
Gavin123



-- 
View this message in context: http://www.nabble.com/ActiveMQ-CPP-client-crashes-creating-producers-thru-a-broken-ethernet-link-with-ActiveMQ-Message-Broker-tf4741138s2354.html#a13557653
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message