Bug 1252338

Summary: Communication with server failed as RestlibException and RemoteServerException
Product: Red Hat Satellite Reporter: Liushihui <shihliu>
Component: CandlepinAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Li Bin Liu <liliu>
Severity: medium Docs Contact:
Priority: unspecified    
Version: UnspecifiedCC: bbuckingham, bkearney, cwelton, greartes, sauchter, shihliu
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-26 15:30:35 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:

Description Liushihui 2015-08-11 08:21:11 UTC
Description of problem:
When unregister system to satellite, it will show "Communication with server failed" as "RestlibException: undefined method `inject' for nil:NilClass" and "RemoteServerException: Server error attempting a POST to /rhsm/hypervisors?owner=ACME_Corporation&env=Library returned status 500"

Version-Release number of selected component (if applicable):
virt-who-0.14-3.el7.noarch
subscription-manager-1.15.9-2.el7.x86_64
python-rhsm-1.15.4-2.el7.x86_64
Satellite 6.1.0-20150731.0

How reproducible:
70%

Steps to Reproduce:
1. Register system to satellite
2. Configure virt-who run at esx mode and refresh interval is 5s, then restart virt-who service
3. Unregister system to satellite, then check the virt-who's log

Actual results:
There are two kinds of failed phenomenon when communicate with server. Sometime it will show "RestlibException", the log as the following
2015-08-11 14:33:29,801 [DEBUG] rhsmd:13892 @ga_loader.py:99 - ga_loader class GaImporterGtk3 loading virtual module subscription_manager.ga from None
2015-08-11 14:33:29,801 [DEBUG] rhsmd:13892 @ga_loader.py:99 - ga_loader class GaImporterGtk3 loading virtual module subscription_manager.ga.GObject from ['gi.repository', 'GObject']
2015-08-11 14:33:29,811 [DEBUG] rhsmd:13892 @ga_loader.py:99 - ga_loader class GaImporterGtk3 loading virtual module subscription_manager.ga.GLib from ['gi.repository', 'GLib']
2015-08-11 14:33:29,827 [ERROR]  @subscriptionmanager.py:171 - Communication with server failed:
Traceback (most recent call last):
  File "/usr/share/virt-who/manager/subscriptionmanager/subscriptionmanager.py", line 167, in hypervisorCheckIn
    result = self.connection.hypervisorCheckIn(config.owner, config.env, serialized_mapping)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 860, in hypervisorCheckIn
    res = self.conn.request_post(url, host_guest_mapping)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 612, in request_post
    return self._request("POST", method, params)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 537, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 579, in validateResponse
    raise RestlibException(response['status'], error_msg)
RestlibException: undefined method `inject' for nil:NilClass
2015-08-11 14:33:29,829 [ERROR]  @virtwho.py:170 - Unable to send data: Communication with subscription manager failed with code 500: undefined method `inject' for nil:NilClass
==============================================================
Sometimes it will show "RemoteServerException" , the failed log as the following:
2015-08-11 14:38:11,985 [ERROR]  @subscriptionmanager.py:171 - Communication with server failed:
Traceback (most recent call last):
  File "/usr/share/virt-who/manager/subscriptionmanager/subscriptionmanager.py", line 167, in hypervisorCheckIn
    result = self.connection.hypervisorCheckIn(config.owner, config.env, serialized_mapping)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 860, in hypervisorCheckIn
    res = self.conn.request_post(url, host_guest_mapping)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 612, in request_post
    return self._request("POST", method, params)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 537, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 585, in validateResponse
    handler=handler)
RemoteServerException: Server error attempting a POST to /rhsm/hypervisors?owner=ACME_Corporation&env=Library returned status 500

Expected results:
It shouldn't show these error in the rhsm.log.virt-who should communicate with satellite normally.

Additional info:

Comment 1 Radek Novacek 2015-08-18 11:53:48 UTC
Reassigning to candlepin. Are these errors intentional? Should be virt-who modified to handle this kind of errors silently or is it something that candlepin or python-rhsm should handle?

Comment 2 Barnaby Court 2016-02-29 19:52:44 UTC
Are you still able to replicate this issue? If you are, please attach the candlepin and katello log files when this issue occurs.

Comment 3 Liushihui 2016-03-01 08:57:01 UTC
It hasn't reproduced on the two latest rhel6.8 against two latest satellite6.1 since virt-who minimum refresh interval update to 60s. 
Can we continually track it on two new rhel6.8 and satellite6.1 version? if it can't reproduce, I will close it.

Comment 5 Bryan Kearney 2016-05-26 15:30:35 UTC
Although this is older, the dupe item has more data.

*** This bug has been marked as a duplicate of bug 1276241 ***