Description of problem: The ManagementTest.test_broker_connectivity_oldAPI test fails constantly when ran against standalone broker. In link to bug 587267. The similar fails are seen on RHEL 4.8 / 5.5 i386 / x86_64 runs, see error below. The test is part of qpid-tests package: grep test_broker_connectivity_oldAPI `rpm -ql qpid-tests | grep ".py$"` /usr/lib/python2.5/site-packages/qpid_tests/broker_0_10/management.py: def test_broker_connectivity_oldAPI (self): Version-Release number of selected component (if applicable): qmf-*0.7.946106-11.el4/5 qpid-cpp-*-0.7.946106-11.el4/5 qpid-java-*0.7.946106-7.el4/5 qpid-tests-0.7.946106-1.el4/5 qpid-tools-0.7.946106-8.el4/5 python-qmf-0.7.946106-8.el4/5 python-qpid-0.7.946106-11.el4/5 How reproducible: 100 Steps to Reproduce: 1. run the test qpid-python-test -b localhost:<port> -m qpid_tests.broker_0_10 Actual results: ManagementTest.test_broker_connectivity_oldAPI fails Expected results: ManagementTest.test_broker_connectivity_oldAPI should not fail Additional info: qpid_tests.broker_0_10.exchange.HeadersExchangeTests.testMatchVoidValue . pass qpid_tests.broker_0_10.management.ManagementTest. \ test_binding_count_on_queue ......................................... pass qpid_tests.broker_0_10.management.ManagementTest. \ test_broker_connectivity_oldAPI ..................................... fail Error during test: Traceback (most recent call last): File "/usr/bin/qpid-python-test", line 311, in run phase() File "/usr/lib/python2.3/site-packages/qpid_tests/broker_0_10/management.py", line 43, in test_broker_connectivity_oldAPI self.assertEqual (len (brokers), 1) File "/usr/lib64/python2.3/unittest.py", line 302, in failUnlessEqual raise self.failureException, \ AssertionError: 0 != 1 qpid_tests.broker_0_10.management.ManagementTest.test_connection_close .. pass qpid_tests.broker_0_10.management.ManagementTest.test_get_objects ....... pass qpid_tests.broker_0_10.exchange.HeadersExchangeTests.testMatchVoidValue . pass qpid_tests.broker_0_10.management.ManagementTest. \ test_binding_count_on_queue ......................................... pass qpid_tests.broker_0_10.management.ManagementTest. \ test_broker_connectivity_oldAPI ..................................... fail Error during test: Traceback (most recent call last): File "/usr/bin/qpid-python-test", line 311, in run phase() File "/usr/lib/python2.4/site-packages/qpid_tests/broker_0_10/management.py", line 43, in test_broker_connectivity_oldAPI self.assertEqual (len (brokers), 1) File "/usr/lib/python2.4/unittest.py", line 333, in failUnlessEqual raise self.failureException, \ AssertionError: 0 != 1 qpid_tests.broker_0_10.management.ManagementTest.test_connection_close .. pass qpid_tests.broker_0_10.management.ManagementTest.test_get_objects ....... pass
The difference in behavior is due to the packaged broker only sending package indications for "store" packages. For some reason, the broker is not sending a package indication for the "broker" package. Trace output against locally built broker (mrg_3.1.x branch): [kgiusti@localhost qpid]$ python/qpid-python-test -b localhost:5672 -m qpid_tests.broker_0_10.management qpid_tests.broker_0_10.management.ManagementTest. \ test_broker_connectivity_oldAPI ..................................... start package ind for org.apache.qpid.broker class ind for org.apache.qpid.broker:agent class ind for org.apache.qpid.broker:binding class ind for org.apache.qpid.broker:bridge class ind for org.apache.qpid.broker:broker class ind for org.apache.qpid.broker:connection class ind for org.apache.qpid.broker:exchange class ind for org.apache.qpid.broker:link class ind for org.apache.qpid.broker:managementsetupstate class ind for org.apache.qpid.broker:queue class ind for org.apache.qpid.broker:session class ind for org.apache.qpid.broker:subscription class ind for org.apache.qpid.broker:system class ind for org.apache.qpid.broker:vhost brokers = [<qpid.management.mgmtObject object at 0x15d52d0>] qpid_tests.broker_0_10.management.ManagementTest. \ test_broker_connectivity_oldAPI ..................................... pass Totals: 1 tests, 1 passed, 0 skipped, 0 ignored, 0 failed Trace against installed candidate broker: [kgiusti@localhost qpid]$ python/qpid-python-test -b 192.168.122.195:5672 -m qpid_tests.broker_0_10.management qpid_tests.broker_0_10.management.ManagementTest. \ test_broker_connectivity_oldAPI ..................................... start package ind for com.redhat.rhm.store class ind for com.redhat.rhm.store:journal class ind for com.redhat.rhm.store:store Schema for (u'org.apache.qpid.broker', u'broker', '\x95z\xe7\xfd\xb7?\r;\xe9\x06\xa6\xe5\xa7N2\xc5') not found! brokers = [] qpid_tests.broker_0_10.management.ManagementTest. \ test_broker_connectivity_oldAPI ..................................... fail Error during test: Traceback (most recent call last): File "python/qpid-python-test", line 311, in run phase() File "/home/kgiusti/Desktop/work/qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/management.py", line 44, in test_broker_connectivity_oldAPI self.assertEqual (len (brokers), 1) File "/usr/lib64/python2.6/unittest.py", line 350, in failUnlessEqual (msg or '%r != %r' % (first, second)) AssertionError: 0 != 1 Totals: 1 tests, 0 passed, 0 skipped, 0 ignored, 1 failed [kgiusti@localhost qpid]$
Verified the following: 1) removing the qpid-cpp-server-store packages causes the test to pass, whereas before removing store the test failed. 2) the test passes when qpidd is run directly from the trunk svn repo without store enabled. Configuring the same qpidd to use store, and the test fails as above. The behavior is unexpected.
I understand the cause of the problem: The old python management code: qpid/python/qpid/management.py, cannot handle a reply message from the broker that packs multiple package indications into a single message. Here is the offending code: def replyCb (self, ch, msg): """ Receive messages via the reply queue of a particular channel. """ codec = Codec (msg.body) hdr = self.checkHeader (codec) if hdr == None: return if hdr[0] == 'm': self.handleMethodReply (ch, codec, hdr[1]) elif hdr[0] == 'z': self.handleCommandComplete (ch, codec, hdr[1]) elif hdr[0] == 'b': self.handleBrokerResponse (ch, codec) elif hdr[0] == 'p': self.handlePackageInd (ch, codec) elif hdr[0] == 'q': self.handleClassInd (ch, codec) else: self.parse (ch, codec, hdr[0], hdr[1]) Compare the above code to the implementation of the topic callback in the same file - this impl correctly loops over the incoming message: def topicCb (self, ch, msg): """ Receive messages via the topic queue of a particular channel. """ codec = Codec (msg.body) while True: hdr = self.checkHeader (codec) if hdr == None: return if hdr[0] == 'p': print("PUG") self.handlePackageInd (ch, codec) elif hdr[0] == 'q': self.handleClassInd (ch, codec) elif hdr[0] == 'h': self.handleHeartbeat (ch, codec) elif hdr[0] == 'e': self.handleEvent (ch, codec) else: self.parse (ch, codec, hdr[0], hdr[1])
Fixed upstream on trunk: Committed revision 984424.
Fix merged to mrg_1.3.x: http://mrg1.lab.bos.redhat.com/git/?p=qpid.git;a=commitdiff;h=43af3b6d4ea16c8ecb3f9f954613b2785c5393b3