Bug 621468

Summary: rejected messages are not dequeued
Product: Red Hat Enterprise MRG Reporter: Gordon Sim <gsim>
Component: qpid-cppAssignee: Jonathan Robie <jonathan.robie>
Status: CLOSED ERRATA QA Contact: Martin Kudlej <mkudlej>
Severity: high Docs Contact:
Priority: high    
Version: betaCC: gsim, iboverma, jneedle, mkudlej, tross
Target Milestone: 1.3.0.1   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
A flaw in the message broker caused rejected messages to remain on the queue. If a durable message was rejected and the broker was restarted, the message would stay in the queue since it was not removed from the durable store. As a result, the rejected message was erroneously redelivered. With this update, the aforementioned defect has been fixed and rejected messages are now properly dequeued.
Story Points: ---
Clone Of:
: 652092 (view as bug list) Environment:
Last Closed: 2010-11-30 17:50:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 652092    

Description Gordon Sim 2010-08-05 07:13:25 UTC
Description of problem:

Rejected messages are dropped, but not dequeued. For durable messages this means they will 're-appear' after a restart. For non-durable messages it means that the queue message count is incorrect.

Comment 1 Jonathan Robie 2010-09-28 12:49:30 UTC
Fixed upstream in commit 1002147.

Adding a test to the store module on qpidcomponents.org.

Comment 2 Gordon Sim 2010-11-03 11:31:29 UTC
The test mentioned in the previous comment was committed to https://svn.jboss.org/repos/rhmessaging/store/trunk/cpp as r4354.

Comment 4 Jeff Needle 2010-11-03 11:46:40 UTC
Test added is here:

svn diff -r4353:4354 http://anonsvn.jboss.org/repos/rhmessaging/store/trunk/cpp

Comment 5 Jonathan Robie 2010-11-05 21:01:31 UTC
Cherry-picked into:

mrg_1.3.x
fa6eab57a32883969ebdd78fa589846068375de7

Comment 6 Ted Ross 2010-11-10 01:55:21 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: A defect in the message broker causes rejected messages to remain on the queue.

Consequence: If a durable message is rejected, and the broker is restarted.  The message will have remained on the queue since it was not removed from the durable store.  In this case, the rejected message is erroneously redelivered.

Fix: The broker defect has been fixed.

Result: Rejected messages are now properly dequeued.

Comment 8 Martin Kudlej 2010-11-11 14:01:31 UTC
Reproduced on version 1.3 on RHEL5.
Tested on RHEL5/4 x i386/x86_64 with
python-qpid-0.7.946106-14
qpid-cpp-client-0.7.946106-19
qpid-cpp-client-devel-0.7.946106-19
qpid-cpp-client-devel-docs-0.7.946106-19
qpid-cpp-client-ssl-0.7.946106-19
qpid-cpp-server-0.7.946106-19
qpid-cpp-server-devel-0.7.946106-19
qpid-cpp-server-ssl-0.7.946106-19
qpid-cpp-server-store-0.7.946106-19
qpid-cpp-server-xml-0.7.946106-19
qpid-java-client-0.7.946106-12
qpid-java-common-0.7.946106-12
qpid-java-example-0.7.946106-12
qpid-tools-0.7.946106-11
qmf-devel-0.7.946106-19
python-qmf-0.7.946106-14
qmf-0.7.946106-19

and it works -->VERIFIED

reproducer:
import sys
import os
from qpid.messaging import *
import qmf.console
import time

if len(sys.argv)<2:
  broker =  "localhost:5672"
else:
  broker = sys.argv[1]

if len(sys.argv)<3:
  address = "amq.topic"
else:
  address = sys.argv[2]

connection = Connection(broker)

try:
  connection.open()
  session = connection.session()

  snd = session.sender("tmr; {create:always, node:{type:queue, durable:True}}")
  rcv = session.receiver("tmr; {create:always, node:{type:queue, durable:True}}")
  m1 = Message("test_message_reject", durable=True, correlation_id="Msg00010")
  snd.send(m1)
  m2 = rcv.fetch()
  session.acknowledge(message=m2, disposition=Disposition(REJECTED))
  connection.close()

  os.system("service qpidd restart")
  time.sleep(20)

  session2 = qmf.console.Session()
  broker = session2.addBroker()
  agent = None;
  for i_agent in session2.getAgents():
    if i_agent.getAgentBank() == '0':
      agent = i_agent;
  queue_list = session2.getObjects(_class="queue", _agent=agent)
  for queue in queue_list:
    if queue.name == "tmr":
      print "queue depth:", queue.msgDepth
      assert queue.msgDepth == 0

  session2.delBroker(broker)

except MessagingError,m:
  print m

Comment 10 errata-xmlrpc 2010-11-30 17:50:50 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2010-0921.html

Comment 11 Martin Prpič 2010-12-01 14:49:42 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,7 +1 @@
-Cause: A defect in the message broker causes rejected messages to remain on the queue.
+A flaw in the message broker caused rejected messages to remain on the queue. If a durable message was rejected and the broker was restarted, the message would stay in the queue since it was not removed from the durable store. As a result, the rejected message was erroneously redelivered. With this update, the aforementioned defect has been fixed and rejected messages are now properly dequeued.-
-Consequence: If a durable message is rejected, and the broker is restarted.  The message will have remained on the queue since it was not removed from the durable store.  In this case, the rejected message is erroneously redelivered.
-
-Fix: The broker defect has been fixed.
-
-Result: Rejected messages are now properly dequeued.