On 06/16/2014 12:51 PM, CLIVE wrote:
Encountered a condition that causes a certain usage of the
qpid::messaging API to segmentation fault.

The following code will cause the failure (QpidBroker is just a class
that starts and stops a QPID broker)

      QpidBroker broker;
      broker.start(5);

      qpid::messaging::Connection connection("localhost","");
      connection.open();

      qpid::messaging::Session  session  = connection.createSession();
      qpid::messaging::Sender   sender   =
session.createSender("amq.topic/fred");

      sender.setCapacity(100);

      // Stop the broker to simulate a broker/network failure,
      broker.stop(2);

      // Send messages, but do not send more than
      // capacity/4 as this causes a flush in the
      // sender implementation.
      for(uint32_t x=0; x < 10; ++x){
         qpid::messaging::Message message;
         message.setContent(content + " : " +
boost::lexical_cast<std::string>(x));
         try {
             sender.send(message,false);
         }
         catch(const qpid::types::Exception& qme){
              // EACH 'send' INVOCATION WILL CAUSE AN EXCEPTION REPORTING
              // NO CONNECTION. BUT MESSAGE WILL BE STORED IN THE SENDERS
              // OUTGOING QUEUE (ASSUMING THE SENDERS FLUSH MECHANISM
              // HASN'T BEEN ACTIVATED).
              //
              // IF THE OUTGOING QUEUE OF THE SENDER IMPLEMENTATION
              // IS NON-ZERO A CALL TO 'getUnsettled' WILL CAUSE A
SEGMENTATION
              // FAULT.
              sender.getUnsettled();
         }
       }

Fyi, I've created a fix for this: https://svn.apache.org/r1604785


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to