Bug 908224

Summary: reconnect_timeout ignored in qpid.messaging.Connection()
Product: Red Hat Enterprise MRG Reporter: Tomas Rusnak <trusnak>
Component: python-qpidAssignee: Ernie <eallen>
Status: CLOSED ERRATA QA Contact: mick <mgoulish>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.3CC: jross, lzhaldyb, mgoulish, rmancy, zkraus
Target Milestone: 3.0Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-qpid-0.22-3.el6, python-qpid-0.22-2.el5 Doc Type: Bug Fix
Doc Text:
It was discovered that the `reconnect_timeout` argument was ignored when creating a connection. Passing a `reconnect_timeout` when creating a connection did not raise an exception after the specified number of seconds. The fix passes the `reconnect_timeout` to the `open()` method, which allows an attempt to create a connection to timeout correctly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-24 15:06:14 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:
Attachments:
Description Flags
Uses reconnect and reconnect_timeout if supplied
none
Updated patch for reconnect and reconnect_timeout none

Description Tomas Rusnak 2013-02-06 08:23:09 UTC
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

Comment 1 Justin Ross 2013-02-27 10:45:02 UTC
*** Bug 735080 has been marked as a duplicate of this bug. ***

Comment 2 Ernie 2013-03-07 19:29:04 UTC
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

Comment 3 Justin Ross 2013-04-23 21:57:29 UTC
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.

Comment 4 Ernie 2013-04-24 21:11:29 UTC
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.

Comment 5 Justin Ross 2013-05-02 10:22:15 UTC
http://svn.apache.org/viewvc?view=revision&revision=1478313

-> POST

Comment 6 mick 2013-07-22 17:10:26 UTC
bug observed on RHEL 6.4, x86_64 

fix verified on RHEL 6.4 x { x86_64, i686 }

Nihil obstat.  Imprimatur.

Comment 8 errata-xmlrpc 2014-09-24 15:06:14 UTC
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