Red Hat Bugzilla – Bug 908224
reconnect_timeout ignored in qpid.messaging.Connection()
Last modified: 2014-09-24 11:06:14 EDT
Description of problem: Calling Connection('localhost',reconnect_timeout=10) will not raise exception after 10 seconds. Version-Release number of selected component (if applicable): python-qpid-0.14-11 python-qpid-0.18-4 How reproducible: 100% Steps to Reproduce: 1. create connection to not started broker with reconnect_timeout 2. call open() 3. check timestamps before open() call and after raised exception Actual results: reconnect_timeout is ignored Expected results: open() must raise exception after reconnect_timeout seconds script used: # cat test.py #!/usr/bin/env python from qpid.messaging import * c = Connection("localhost", reconnect=True, reconnect_timeout=1) c.open() # time ./test.py
*** Bug 735080 has been marked as a duplicate of this bug. ***
Created attachment 706773 [details] Uses reconnect and reconnect_timeout if supplied Modifies open() to pass the reconnect_timeout value to attach() Modifies attach() to use same logic as detach(): - accepts defaulted timeout argument - passes timeout argument to _ewait - inspects return from _ewait and raises Timeout exception if return was False
Firsst, in my checkout I modified one part of the patch: ndex: qpid/messaging/endpoints.py =================================================================== --- qpid/messaging/endpoints.py (revision 1471163) +++ qpid/messaging/endpoints.py (working copy) @@ -264,7 +264,10 @@ if self._open: raise ConnectionError("already open") self._open = True - self.attach() + timeout = None + if self.reconnect and self.reconnect_timeout > 0: + timeout = self.reconnect_timeout + self.attach(timeout=timeout) @synchronized def opened(self): I believe that's equivalent. Second, is the code exercised in the tests? Third, please link in a jira.
Created attachment 739604 [details] Updated patch for reconnect and reconnect_timeout Adds self.reconnect = False after a timeout to prevent the engine from continuing to retry. Also adds the python endpoint test testConnectionOpen.
http://svn.apache.org/viewvc?view=revision&revision=1478313 -> POST
bug observed on RHEL 6.4, x86_64 fix verified on RHEL 6.4 x { x86_64, i686 } Nihil obstat. Imprimatur.
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/RHEA-2014-1296.html