[
https://issues.apache.org/jira/browse/QPID-2320?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12796497#action_12796497
]
Carl Trieloff commented on QPID-2320:
-------------------------------------
Here is a diff which I think resolves it, take a look and I will commit if not
comments.
Index: tests/QueueTest.cpp
===================================================================
--- tests/QueueTest.cpp (revision 895748)
+++ tests/QueueTest.cpp (working copy)
@@ -544,9 +544,14 @@
framing::SequenceNumber sequence(1);
QueuedMessage qmsg(queue.get(), msg1, sequence);
QueuedMessage qmsg2(queue.get(), msg2, ++sequence);
+ framing::SequenceNumber sequence1(10);
+ QueuedMessage qmsg3(queue.get(), 0, sequence1);
BOOST_CHECK(!queue->acquire(qmsg));
BOOST_CHECK(queue->acquire(qmsg2));
+ // Acquire the massage again to test failure case.
+ BOOST_CHECK(!queue->acquire(qmsg2));
+ BOOST_CHECK(!queue->acquire(qmsg3));
BOOST_CHECK_EQUAL(queue->getMessageCount(), 2u);
Index: qpid/broker/Queue.cpp
===================================================================
--- qpid/broker/Queue.cpp (revision 895748)
+++ qpid/broker/Queue.cpp (working copy)
@@ -263,9 +263,10 @@
Mutex::ScopedLock locker(messageLock);
QPID_LOG(debug, "attempting to acquire " << msg.position);
Messages::iterator i = findAt(msg.position);
- if ((i != messages.end() && !lastValueQueue) // note that in some cases
payload not be set
- || (lastValueQueue && (i->position == msg.position) &&
- msg.payload.get() == checkLvqReplace(*i).payload.get()) ) {
+ if ((i != messages.end() && msg.payload.get()) && // note that in some
cases payload not be set
+ (!lastValueQueue ||
+ (lastValueQueue && (i->position == msg.position) && msg.payload.get()
== checkLvqReplace(*i).payload.get()) )
+ ) {
clearLVQIndex(msg);
QPID_LOG(debug,
@@ -273,9 +274,7 @@
i->position << " == " << msg.position);
messages.erase(i);
return true;
- } else {
- QPID_LOG(debug, "No match: " << i->position << " != " << msg.position);
- }
+ }
QPID_LOG(debug, "Acquire failed for " << msg.position);
return false;
> Failed acquire on LVQ causes broker crash
> -----------------------------------------
>
> Key: QPID-2320
> URL: https://issues.apache.org/jira/browse/QPID-2320
> Project: Qpid
> Issue Type: Bug
> Components: C++ Broker
> Affects Versions: 0.6
> Reporter: Gordon Sim
>
> If an acquire fails for an LVQ because the message has already been acquired
> by some other subscriber, the failed attempt causes the broker to crash. This
> is due to lack of proper bounds checking in Queue::acquire() for the LVQ case
> and was I believe introduced by
> http://svn.apache.org/viewvc?view=revision&revision=834172.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]