Bug 690423

Summary: [xmlrpc] - xmlrpc loses connection to the server after a short timeout
Product: [Other] TCMS Reporter: Yuguang Wang <yuwang>
Component: ApplicationAssignee: Yuguang Wang <yuwang>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: high Docs Contact:
Priority: medium    
Version: 3.3CC: ctang, junzhang, jzhao, mbenenso, nli, vchen, xgao
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 3.4-5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-30 08:58:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 704162    

Description Yuguang Wang 2011-03-24 10:29:12 UTC
Description of problem:
As subject, using nitrate.py and f14 x86_64

Version-Release number of selected component (if applicable):


How reproducible:
100%


Steps to Reproduce:
See comment 1
  
Actual results:
Connection time out, trackback:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "nitrate.py", line 383, in get_me
    return self.do_command("User.get_me")
  File "nitrate.py", line 359, in do_command
    return eval(cmd)
  File "<string>", line 1, in <module>
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1570, in __request
    verbose=self.__verbose
  File "nitrate.py", line 78, in request
    response = h.getresponse()
  File "/usr/lib64/python2.7/httplib.py", line 1025, in getresponse
    response.begin()
  File "/usr/lib64/python2.7/httplib.py", line 401, in begin
    version, status, reason = self._read_status()
  File "/usr/lib64/python2.7/httplib.py", line 365, in _read_status
    raise BadStatusLine(line)
httplib.BadStatusLine: ''
>>> n.get_me()
self.server.User.get_me()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "nitrate.py", line 383, in get_me
    return self.do_command("User.get_me")
  File "nitrate.py", line 359, in do_command
    return eval(cmd)
  File "<string>", line 1, in <module>
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1570, in __request
    verbose=self.__verbose
  File "nitrate.py", line 71, in request
    self.send_request(h,handler,request_body)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1391, in send_request
    connection.putrequest("POST", handler, skip_accept_encoding=True)
  File "/usr/lib64/python2.7/httplib.py", line 845, in putrequest
    raise CannotSendRequest()
httplib.CannotSendRequest


Expected results:
Can work correctly.

Additional info:

Comment 1 Yuguang Wang 2011-03-24 10:30:50 UTC
Hi guys,

I am using your nitrate.py file for our automation purposes and it worked fine till the last week.
Since the last week it seems like the connection between Nitrate xmlrpc service
and TCMS MySql DB resets after few seconds (see ipython output, TcmsAgent uses nitrate.py):

In [2]: obj = TcmsAgent('mbenenso')
self.server.Auth.login_krbv()

In [3]: obj.init(test_type='Functionality', build_name='ic105', product_name='RHEVM', product_version='4.6', product_category='API', header_names='testName:sub_test,caseName:info,info:text,dcType:text')
self.server.Product.get_plans('119')
self.server.Product.get_cases('119')
self.server.Product.get_versions('119')
self.server.Product.get_categories('119')
self.server.Product.get_builds('119')
self.server.User.get_me()
self.server.TestPlan.check_plan_type('Functionality')

In [4]: obj._isTestCaseAttachedToPlan('72542', '3173')
self.server.TestCase.get_plans(72542)
Out[4]: True

In [5]: obj._isTestCaseAttachedToPlan('72542', '3173')
self.server.TestCase.get_plans(72542)
Out[5]: True

In [6]: obj._isTestCaseAttachedToPlan('72542', '3173')
self.server.TestCase.get_plans(72542)
''
Traceback (most recent call last):
  File "nitrateApi.py", line 349, in do_command
    return eval(cmd)
  File "<string>", line 1, in <module>
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.7/xmlrpclib.py", line 1570, in __request
    verbose=self.__verbose
  File "nitrateApi.py", line 74, in request
    response = h.getresponse()
  File "/usr/lib64/python2.7/httplib.py", line 1025, in getresponse
    response.begin()
  File "/usr/lib64/python2.7/httplib.py", line 401, in begin
    version, status, reason = self._read_status()
  File "/usr/lib64/python2.7/httplib.py", line 365, in _read_status
    raise BadStatusLine(line)
BadStatusLine: ''

Out[6]: False


I am catching this exception in the do_command() method of nitrate.py using traceback.format_exc().
After additional call to NitrateKerbXmlrpc c'tor the connection re-connects and works again:

In [16]: obj.nitrateApi = nitrateApi.NitrateKerbXmlrpc(obj.tcmsUrl)
self.server.Auth.login_krbv()

In [17]: obj._isTestCaseAttachedToPlan('72542', '3173')
self.server.TestCase.get_plans(72542)
Out[17]: True


NOTE: I am using Python 2.7 and I already updated nitrate.py code to support the latest xmlrpc.

Comment 2 Yuguang Wang 2011-03-24 10:33:17 UTC
It's from Max Benenson
(In reply to comment #1)
> Hi guys,
> 
> I am using your nitrate.py file for our automation purposes and it worked fine
> till the last week.
> Since the last week it seems like the connection between Nitrate xmlrpc service
> and TCMS MySql DB resets after few seconds (see ipython output, TcmsAgent uses
> nitrate.py):
> 
> In [2]: obj = TcmsAgent('mbenenso')
> self.server.Auth.login_krbv()
> 
> In [3]: obj.init(test_type='Functionality', build_name='ic105',
> product_name='RHEVM', product_version='4.6', product_category='API',
> header_names='testName:sub_test,caseName:info,info:text,dcType:text')
> self.server.Product.get_plans('119')
> self.server.Product.get_cases('119')
> self.server.Product.get_versions('119')
> self.server.Product.get_categories('119')
> self.server.Product.get_builds('119')
> self.server.User.get_me()
> self.server.TestPlan.check_plan_type('Functionality')
> 
> In [4]: obj._isTestCaseAttachedToPlan('72542', '3173')
> self.server.TestCase.get_plans(72542)
> Out[4]: True
> 
> In [5]: obj._isTestCaseAttachedToPlan('72542', '3173')
> self.server.TestCase.get_plans(72542)
> Out[5]: True
> 
> In [6]: obj._isTestCaseAttachedToPlan('72542', '3173')
> self.server.TestCase.get_plans(72542)
> ''
> Traceback (most recent call last):
>   File "nitrateApi.py", line 349, in do_command
>     return eval(cmd)
>   File "<string>", line 1, in <module>
>   File "/usr/lib64/python2.7/xmlrpclib.py", line 1224, in __call__
>     return self.__send(self.__name, args)
>   File "/usr/lib64/python2.7/xmlrpclib.py", line 1570, in __request
>     verbose=self.__verbose
>   File "nitrateApi.py", line 74, in request
>     response = h.getresponse()
>   File "/usr/lib64/python2.7/httplib.py", line 1025, in getresponse
>     response.begin()
>   File "/usr/lib64/python2.7/httplib.py", line 401, in begin
>     version, status, reason = self._read_status()
>   File "/usr/lib64/python2.7/httplib.py", line 365, in _read_status
>     raise BadStatusLine(line)
> BadStatusLine: ''
> 
> Out[6]: False
> 
> 
> I am catching this exception in the do_command() method of nitrate.py using
> traceback.format_exc().
> After additional call to NitrateKerbXmlrpc c'tor the connection re-connects and
> works again:
> 
> In [16]: obj.nitrateApi = nitrateApi.NitrateKerbXmlrpc(obj.tcmsUrl)
> self.server.Auth.login_krbv()
> 
> In [17]: obj._isTestCaseAttachedToPlan('72542', '3173')
> self.server.TestCase.get_plans(72542)
> Out[17]: True
> 
> 
> NOTE: I am using Python 2.7 and I already updated nitrate.py code to support
> the latest xmlrpc.

Comment 4 Jin Zhao 2011-05-10 08:22:39 UTC
Verify version: 3.4 on englab

Actual result:
xmlrpclib.ProtocolError: <ProtocolError for tcms.englab.nay.redhat.com/xmlrpc/: 401 Authorization Required>

verify result: FAIL

Comment 5 Jin Zhao 2011-05-18 09:48:30 UTC
Verify version: 3.4 on stage (3.4-5)

Actual result:
Can not reproduce this issue on stage env.

Verify result: PASS