Bug 871774
| Summary: | Browser may read messages acquired by other consumer on message group queue | ||
|---|---|---|---|
| Product: | Red Hat Enterprise MRG | Reporter: | Petr Matousek <pematous> |
| Component: | qpid-cpp | Assignee: | Ken Giusti <kgiusti> |
| Status: | CLOSED ERRATA | QA Contact: | Petr Matousek <pematous> |
| Severity: | medium | Docs Contact: | |
| Priority: | high | ||
| Version: | Development | CC: | iboverma, jross, kgiusti, mcressma |
| Target Milestone: | 2.3 | Keywords: | Regression |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | qpid-cpp-0.18-6 | Doc Type: | Bug Fix |
| Doc Text: |
Cause: The algorithm for browsing messages changed, but the message group code was not updated correctly.
Consequence: A message acquired by a client would still remain visible to browsing clients.
Fix: The message group code was updated to the new algorithm.
Result: Acquired group messages are no longer visible to other browsing clients.
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | 2013-03-06 18:52:38 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Petr Matousek
2012-10-31 11:00:39 UTC
I think I have a fix for this:
diff --git a/qpid/cpp/src/qpid/broker/MessageGroupManager.cpp b/qpid/cpp/src/qpid/broker/MessageGroupManager.cpp
index bc5d797..c30f009 100644
--- a/qpid/cpp/src/qpid/broker/MessageGroupManager.cpp
+++ b/qpid/cpp/src/qpid/broker/MessageGroupManager.cpp
@@ -260,7 +260,7 @@ bool MessageGroupManager::allocate(const std::string& consumer, const QueuedMess
bool MessageGroupManager::nextBrowsableMessage( Consumer::shared_ptr& c, QueuedMessage& next )
{
// browse: allow access to any available msg, regardless of group ownership (?ok?)
- return messages.browse(c->getPosition(), next, false);
+ return messages.browse(c->getPosition(), next, !c->browseAcquired());
}
void MessageGroupManager::query(qpid::types::Variant::Map& status) const
this allows the reproducer to pass, but for some reason one of the message groups unit test is failing. I'll have to look at it a bit more.
Ok, I understand this a bit more:
There was a change to the qpid::broker::Consumer class that added a flag that controlled whether acquired messages are browsable [Consumer::browseAcquired()]. This flag defaults to false (do not browse acquired messages).
The msg group code was not updated to reference this flag.
The following patch is also needed to correct one of the message group tests:
diff --git a/qpid/tests/src/py/qpid_tests/broker_0_10/msg_groups.py b/qpid/tests/src/py/qpid_tests/broker_0_10/msg_groups.py
index ace7611..c9c498b 100644
--- a/qpid/tests/src/py/qpid_tests/broker_0_10/msg_groups.py
+++ b/qpid/tests/src/py/qpid_tests/broker_0_10/msg_groups.py
@@ -767,10 +767,10 @@ class MultiConsumerMsgGroupTests(Base):
'filter_params' : { 'header_key' : "THE-GROUP",
'header_value' : "A" }}
assert queue.msgDepth == 6
- rc = queue.purge(1, msg_filter)
+ rc = queue.purge(1, msg_filter) # should purge A-2 (first available)
assert rc.status == 0
queue.update()
- queue.msgDepth == 5 # the pending acquired A still counts!
+ queue.msgDepth == 4
# verify all other A's removed....
s2 = self.setup_session()
@@ -787,7 +787,7 @@ class MultiConsumerMsgGroupTests(Base):
except Empty:
pass
assert count == 3 # non-A's
- assert a_count == 2 # pending acquired message included in browse results
+ assert a_count == 1 # Only one (unacquired) A msg
s1.acknowledge() # ack the consumed A-0
self.qmf_session.delBroker(self.qmf_broker)
It appears that the test was incorrectly modified to work with browsing acquired messages as part of the original patch that added the browseAcquired() flag.
Justin - do you agree?
This all makes sense to me. Thanks, Ken. This issue has been fixed in the broker (qpid-cpp-0.18-6). qpid-tests package needs to be rebuild to correct the unit test mentioned in comment 4 (successfully tested with the patch). Leaving open until that time. This issue has been fixed. Verified on rhel5 and rhel6 (both i386,x86_64) packages used for testing: qpid-cpp-*-0.18-7 -> VERIFIED Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2013-0561.html |