Bug 442591 - Federation: messages statically routed even if there is no consumer at destination
Summary: Federation: messages statically routed even if there is no consumer at destin...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-cpp
Version: 1.0
Hardware: All
OS: Linux
high
low
Target Milestone: 1.1
: ---
Assignee: Ted Ross
QA Contact: Kim van der Riet
URL:
Whiteboard:
: 446937 (view as bug list)
Depends On:
Blocks: 471302
TreeView+ depends on / blocked
 
Reported: 2008-04-15 18:11 UTC by Ted Ross
Modified: 2009-02-04 15:37 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-02-04 15:37:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2009:0035 0 normal SHIPPED_LIVE Red Hat Enterprise MRG Messaging 1.1 Release 2009-02-04 15:33:44 UTC

Description Ted Ross 2008-04-15 18:11:48 UTC
Description of problem:

In broker federation, routes are completely static.  Messages are routed to
destinations even if there are no bound consumers for the message at the
destination.

Some form of dynamic routing involving the dynamic management of binding keys on
the federation links is needed to provide a valuable/required optimization.

Comment 1 Gordon Sim 2008-06-20 08:16:21 UTC
*** Bug 446937 has been marked as a duplicate of this bug. ***

Comment 2 Ted Ross 2008-10-28 15:17:42 UTC
There is a new dynamic-binding feature that addresses this issue.  It can be verified by creating a simple network of two federated brokers.

Here is a shell script to set up the network:

== begin script "setup" ==
broker1=localhost:5672
broker2=localhost:10000

##
## Declare federated direct exchange
##
qpid-config -a $broker1 add exchange direct fed.direct
qpid-config -a $broker2 add exchange direct fed.direct

##
## Create dynamic routes bidirectionally
##
qpid-route dynamic add $broker1 $broker2 fed.direct
qpid-route dynamic add $broker2 $broker1 fed.direct
== end script ==

Note that no binding keys are specified in the creation of the dynamic routes.

The direct example can then be run against the brokers by producing to one broker and consuming from the other.  When the "declare_queues" script is run, it should be run on the consumer broker:

To verify that messages are being forwarded only when needed, use the following Python script:


== begin script "check.py" ==
from qpid.qmfconsole import Session

s = Session()
b = s.addBroker("localhost")

exchanges = s.getObjects(_class="exchange")
for exchange in exchanges:
  if exchange.name == "fed.direct":
    print "Exchange:", exchange.name
    print "received:", exchange.msgReceives
    print "dropped: ", exchange.msgDrops
    print "routed:  ", exchange.msgRoutes

s.delBroker(b)
== end script ==

Here's the procedure for running the test.  Do this in the qpid/cpp/examples/direct directory.

1) Start brokers on the default port (5672) and on port 10000
2) Run the setup script

   $ ./setup

3) Baseline the stats:

   $ python check.py
   Exchange: fed.direct
   received: 0
   dropped:  0
   routed:   0

4) Produce messages:

   $ ./direct_producer localhost 5672 10 fed.direct

5) Check the stats:

   $ python check.py
   Exchange: fed.direct
   received: 11
   dropped:  11
   routed:   0

Verify that the messages were received and dropped (because of no consumer on the other broker).

6) Add a consumer on the other broker:

   $ ./declare_queues localhost 10000 fed.direct

7) Run a listener:

   $ ./listener localhost 10000 &

8) Produce messages again:

   $ ./direct_producer localhost 5672 10 fed.direct
   Message: Message 0
   Message: Message 1
   Message: Message 2
   Message: Message 3
   Message: Message 4
   Message: Message 5
   Message: Message 6
   Message: Message 7
   Message: Message 8
   Message: Message 9
   Message: That's all, folks!
   Shutting down listener for message_queue

Verify that the messages were received by the listener (messages printed above).

9) Check the stats:

   $ python check.py
   Exchange: fed.direct
   received: 22
   dropped:  11
   routed:   11

Verifies that messages were forwarded only when there was an interested consumer.

Comment 4 Frantisek Reznicek 2008-11-27 15:20:39 UTC
Hello Ted,
thanks for great reproducer details...
I'm not able to reproduce it because of following facts facts:

- not sure when to run declare_queues (assuming at 3.5])
- 6) Add a consumer on the other broker:
  $ ./declare_queues localhost 10000 fed.direct
  should it be ./direct_producer?
- assuming that ./direct_producer need to take number of messages and destination as argument - done

Still not able to get there. Could you possibly check my transcript what I do wrong, please?
[freznice@dhcp-lab-200 direct]$ mkdir data1 data2
[freznice@dhcp-lab-200 direct]$ /usr/sbin/qpidd --auth no --log-enable info+ --data-dir data1 -p 5672 > qpidd5672.log 2>&1 &
[1] 18750
[freznice@dhcp-lab-200 direct]$ /usr/sbin/qpidd --auth no --log-enable info+ --data-dir data2 -p 10000 > qpidd10000.log 2>&1 &
[2] 18763
[freznice@dhcp-lab-200 direct]$ tail qpidd5672.log
2008-nov-27 16:20:40 info > TPL journal file size: 24 (wpgs)
2008-nov-27 16:20:40 info > TPL write cache page size: 4 (Kib)
2008-nov-27 16:20:40 info > TPL number of write cache pages: 64
2008-nov-27 16:20:40 info Listening on TCP port 5672
2008-nov-27 16:20:40 info Registered xml exchange
2008-nov-27 16:20:40 info Policy file not specified. ACL Disabled, no ACL checking being done!
libibverbs: Warning: RLIMIT_MEMLOCK is 32768 bytes.
    This will severely limit memory registrations.
2008-nov-27 16:20:40 info Rdma: Disabled: no rdma devices found
2008-nov-27 16:20:40 warning SSL plugin not enabled, you must set --qpid-ssl-cert-db to enable it.
[freznice@dhcp-lab-200 direct]$ tail qpidd10000.log
2008-nov-27 16:20:46 info > TPL journal file size: 24 (wpgs)
2008-nov-27 16:20:46 info > TPL write cache page size: 4 (Kib)
2008-nov-27 16:20:46 info > TPL number of write cache pages: 64
2008-nov-27 16:20:46 info Listening on TCP port 10000
2008-nov-27 16:20:46 info Registered xml exchange
2008-nov-27 16:20:46 info Policy file not specified. ACL Disabled, no ACL checking being done!
libibverbs: Warning: RLIMIT_MEMLOCK is 32768 bytes.
    This will severely limit memory registrations.
2008-nov-27 16:20:46 info Rdma: Disabled: no rdma devices found
2008-nov-27 16:20:46 warning SSL plugin not enabled, you must set --qpid-ssl-cert-db to enable it.
[freznice@dhcp-lab-200 direct]$ jobs
[1]-  Running                 /usr/sbin/qpidd --auth no --log-enable info+ --data-dir data1 -p 5672 > qpidd5672.log 2>&1 &
[2]+  Running                 /usr/sbin/qpidd --auth no --log-enable info+ --data-dir data2 -p 10000 > qpidd10000.log 2>&1 &
[freznice@dhcp-lab-200 direct]$ bash ../setup.sh
[freznice@dhcp-lab-200 direct]$ python ../check.py
Exchange: fed.direct
received: 0
dropped:  0
routed:   0
[freznice@dhcp-lab-200 direct]$ ./direct_producer.py localhost 5672 fed.direct
[freznice@dhcp-lab-200 direct]$ python ../check.py
Exchange: fed.direct
received: 11
dropped:  11
routed:   0
[freznice@dhcp-lab-200 direct]$ ./declare_queues.py localhost 10000
[freznice@dhcp-lab-200 direct]$ echo $?
0
[freznice@dhcp-lab-200 direct]$ ./listener.py localhost 10000 &
[3] 18824
[freznice@dhcp-lab-200 direct]$
[freznice@dhcp-lab-200 direct]$ jobs
[1]   Running                 /usr/sbin/qpidd --auth no --log-enable info+ --data-dir data1 -p 5672 > qpidd5672.log 2>&1 &
[2]-  Running                 /usr/sbin/qpidd --auth no --log-enable info+ --data-dir data2 -p 10000 > qpidd10000.log 2>&1 &
[3]+  Running                 ./listener.py localhost 10000 &
[freznice@dhcp-lab-200 direct]$ ./direct_producer.py localhost 5672 fed.direct
[freznice@dhcp-lab-200 direct]$ python ../check.py
Exchange: fed.direct
received: 22
dropped:  22
routed:   0


Thanks you very much.

Comment 5 Ted Ross 2008-12-01 19:07:15 UTC
Frantisek,

In the above example, I used a feature of the example code that has since been removed.  You can no longer specify an exchange name in the command line for "declare-queues", "direct-producer", or "listener".

Perhaps, the easiest solution is to modify the examples temporarily for this test.  To do this, replace instances of "amq.direct" with "fed.direct" in declare-queues.cpp, direct-producer.cpp, and listener.cpp.  Then type "make" in the qpid/cpp/examples/direct directory to get updated executables.

Alternatively, you can run the reproducer procedure against "amq.direct" instead of "fed.direct".  This involves changing "fed.direct" to "amq.direct" in the scripts.  If you do this, be advised that the statistics will not be pure because there will be other traffic flowing across the amq.direct exchange during the procedure.

Comment 6 Frantisek Reznicek 2008-12-03 10:24:14 UTC
Above mentioned step-by-step guide finally reproduced.
The problem was on the point 6 where local message queue was bind to amq.direct insted of fed.direct... Thank you for your patience with me.
Validated on RHEL 5.2 / 4.7 , i386 / x86_64
->VERIFIED

Comment 8 errata-xmlrpc 2009-02-04 15:37:02 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/RHEA-2009-0035.html


Note You need to log in before you can comment on or make changes to this bug.