Hi,

I have a program that sends messages to a topic exchange using the C++ messaging API. The messages are generally directed to a single receiver queue. I thought it worked just fine (as always), but now I notice that it gets stuck a short while after start-up. Simply put, the sender.send() in the below "publish" routine never returns - not the first time it's used, but after sending 50 or so nearly identical messages.


std::string publishArgs()
{
  std::string exchangeArgs="create: sender, delete: never";

  exchangeArgs+=", node: { type: topic, durable: False }";

  return exchangeArgs;
}

bool publish(qpid::messaging::Session &session,
           const qpid::messaging::Message &message)
{
  std::string exchangeName=publishExchange();
  try {
    qpid::messaging::Sender sender;

    try {
      sender=session.getSender(exchangeName);
    } catch(qpid::messaging::KeyError &error) {
      std::string exchangeArgs=publishArgs();
      std::string address=exchangeName + "; { " + exchangeArgs + " }";

      sender=session.createSender(address);
    }

    sender.send(message);
  } catch(const qpid::types::Exception &error) {
    fprintf(stderr, "Error - \"%s\" when sending message to %s/%s\n",
error.what(), exchangeName.c_str(), message.getSubject().c_str());

    return false;
  }
  return true;
}

The problem seems to be that

void SessionImpl::waitForCompletion(const SequenceNumber& id)
{
    Lock l(state);
    sys::Waitable::ScopedWait w(state);
    waitForCompletionImpl(id);
}

for some reason waits forever - in the pthread_cond_wait() triggered indirectly by waitCompletionImpl(). It looks like all messages leading up to the one where everything locks up, appear as expected on the receiver queue.

Most of the sending code is actually shared with other applications - but they are use different subjects that are associated with different queues. At least one of them sends through the same exchange, though.

Does anyone have any idea what may be wrong? Maybe it's hard to tell without seeing the full code, which is hard to include as it's a bit complex, but where can I start looking for explanations for the behaviour?


QPid version is 0.34.

Thanks,

- Toralf








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

Reply via email to