qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: qpid::messaging::Sender::getUnsettled causes segmentation fault
Date Tue, 24 Jun 2014 10:41:08 GMT
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: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Mime
View raw message