Bug 1320371 - Failed to list available pools as RateLimitExceededException
Summary: Failed to list available pools as RateLimitExceededException
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.0
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Kevin Howell
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-23 03:24 UTC by Liushihui
Modified: 2017-08-09 21:06 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 19:18:42 UTC
Target Upstream Version:


Attachments (Terms of Use)
rhsm.log (1.67 MB, text/plain)
2016-03-23 03:33 UTC, Liushihui
no flags Details


Links
System ID Priority Status Summary Last Updated
Github candlepin python-rhsm pull 185 'None' closed 1320371: Fix case of retry-after header handling 2020-01-26 05:51:20 UTC
Github candlepin subscription-manager pull 1501 'None' closed 1320371: Display user-friendly rate limit messages 2020-01-26 05:51:20 UTC
Red Hat Product Errata RHBA-2017:2083 normal SHIPPED_LIVE python-rhsm and subscription-manager bug fix and enhancement update 2017-08-01 18:14:19 UTC

Description Liushihui 2016-03-23 03:24:26 UTC
Description of problem:
When RateLimitExceededException exception caught in subscription-manager, it will failed to list available pool.

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


How reproducible:


Steps to Reproduce:
1. Register system to stage candlepin
[root@ibm-hs22-04 ~]# subscription-manager register --usename=stage_virtwho_test_2016 --password=redhat
2. Configure virt-who run at kvm mode and refresh interval is default(60s), restart virt-who service
[root@ibm-hs22-04 ~]# service virt-who restart
3. Check the virt-who's log ,when it occurred "RateLimitExceededException", then check available pool in terminal side.
[root@ibm-hs22-04 ~]# subscription-manager list --available

[root@ibm-hs22-04 ~]# tail -f /var/log/rhsm/rhsm.log
2016-03-22 23:11:51,894 [DEBUG] subscription-manager:21347 @connection.py:557 - Making request: PUT /subscription/consumers/1077c7cc-cfae-48b4-9406-a8a928879b93
2016-03-22 23:11:52,318 [DEBUG] subscription-manager:21347 @connection.py:589 - Response: status=429
2016-03-22 23:11:52,318 [ERROR] subscription-manager:21347 @managercli.py:174 - exception caught in subscription-manager
2016-03-22 23:11:52,318 [ERROR] subscription-manager:21347 @managercli.py:175 - 
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 86, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 77, in main
    return managercli.ManagerCLI().main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 2699, in main
    return CLI.main(self)
  File "/usr/share/rhsm/subscription_manager/cli.py", line 160, in main
    return cmd.main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 503, in main
    return_code = self._do_command()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 2288, in _do_command
    filter_string=self.options.filter_string)
  File "/usr/share/rhsm/subscription_manager/managerlib.py", line 314, in get_available_entitlements
    overlapping, uninstalled, text, filter_string)
  File "/usr/share/rhsm/subscription_manager/managerlib.py", line 519, in get_filtered_pools_list
    self.identity.uuid, self.facts, active_on=active_on, filter_string=filter_string):
  File "/usr/share/rhsm/subscription_manager/managerlib.py", line 269, in list_pools
    facts.update_check(uep, consumer_uuid)
  File "/usr/share/rhsm/subscription_manager/cache.py", line 164, in update_check
    raise re
RateLimitExceededException

Actual results:
It can't list available pools, it show null pool.please see the rhsm log in attachment.

Expected results:
It should list available pools in terminal side

Additional info:

Comment 1 Liushihui 2016-03-23 03:32:27 UTC
Version-Release number of selected component (if applicable):
subscription-manager-1.16.8-7.el6.x86_64
python-rhsm-1.16.6-1.el6.x86_64
virt-who-0.16-7.el6.noarch

Comment 2 Liushihui 2016-03-23 03:33:24 UTC
Created attachment 1139316 [details]
rhsm.log

Comment 3 Liushihui 2016-03-31 02:34:08 UTC
When occurred "RateLimitExceededException" in the log, it can't get correct consumed "Status Details" and wrong installed "status", please see detail as the following:
# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux Server
Product ID:     69
Version:        6.8 Beta
Arch:           x86_64
Status:         Unknown      ************************It should "Subscribed"
Status Details: 
Starts:         02/29/2016
Ends:           02/27/2017

Product Name:   Red Hat Enterprise Linux 6 Server HTB
Product ID:     135
Version:        6.8 HTB
Arch:           x86_64
Status:         Unknown
Status Details: 
Starts:         
Ends:           

# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   Red Hat Enterprise Linux Server, Premium (Physical or Virtual Nodes)
Provides:            Red Hat Enterprise Linux High Performance Networking (for RHEL Server) - Extended Update Support
                     Oracle Java (for RHEL Server)
                     Red Hat Enterprise Linux Server - Extended Update Support
                     Red Hat Enterprise Linux Atomic Host
                     Red Hat Enterprise Linux Server
                     Red Hat EUCJP Support (for RHEL Server) - Extended Update Support
                     Oracle Java (for RHEL Server) - Extended Update Support
                     Red Hat Enterprise Linux Resilient Storage (for RHEL Server) - Extended Update Support
                     Red Hat Beta
                     Red Hat Software Collections (for RHEL Server)
                     Red Hat Enterprise Linux Atomic Host Beta
                     Red Hat Developer Toolset (for RHEL Server)
                     Red Hat Enterprise Linux High Availability (for RHEL Server) - Extended Update Support
                     Red Hat Enterprise Linux Scalable File System (for RHEL Server) - Extended Update Support
                     Red Hat Software Collections Beta (for RHEL Server)
                     Red Hat Enterprise Linux Load Balancer (for RHEL Server) - Extended Update Support
                     Red Hat Container Images
                     Red Hat Container Images Beta
                     Red Hat S-JIS Support (for RHEL Server) - Extended Update Support
SKU:                 RH00003
Contract:            10752424
Account:             5584289
Serial:              6653370622772258976
Pool ID:             8a99f98a532ba0970153355a805828a7
Provides Management: No
Active:              True
Quantity Used:       8
Service Level:       Premium
Service Type:        L1-L3
***********************It should "Subscription is current"*************
Status Details:      Subscription management service doesn't support Status Details.            
****************************************************************************
Subscription Type:   
Starts:              02/29/2016
Ends:                02/27/2017
System Type:         Physical

Comment 6 Chris Snyder 2016-09-30 14:56:46 UTC
@subman_dev: The fix for this should be to print a descriptive error message. Something like "The API rate limit has been exceeded, please try again later". If possible include the time to try again from the exception.

Comment 9 Rehana 2017-05-05 15:39:06 UTC
Retesting : 

# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.51.21-1
subscription management rules: 5.15.1
subscription-manager: 1.19.12-1.el7
python-rhsm: 1.19.6-1.el7


# To hit ratelimit error, configure cert and auto-attach interval to short time interval and wait for the ratelimit exceed exception to appear

As mentioned in the comment 4 , when you try to use any of those call after the Ratelimit Exceed Exception; subscription-manager now displays appropriate error message on the terminal 

ex: 

# subscription-manager release --list
The server rate limit has been exceeded, please try again later.

rhsm.log;
=========

2017-05-05 11:37:48,947 [INFO] subscription-manager:29196:MainThread @connection.py:780 - Connection built: host=subscription.rhsm.stage.redhat.com port=443 handler=/subscription auth=none
2017-05-05 11:37:48,948 [INFO] subscription-manager:29196:MainThread @managercli.py:386 - Consumer Identity name=ibm-x3650m4-01-vm-10.lab.eng.bos.redhat.com uuid=12f1a264-a49d-4910-802f-c3b0f49d17ca
2017-05-05 11:37:49,411 [INFO] subscription-manager:29196:MainThread @connection.py:520 - Response: status=429, request="GET /subscription/consumers/12f1a264-a49d-4910-802f-c3b0f49d17ca"
2017-05-05 11:37:49,411 [ERROR] subscription-manager:29196:MainThread @managercli.py:179 - exception caught in subscription-manager
2017-05-05 11:37:49,412 [ERROR] subscription-manager:29196:MainThread @managercli.py:180 - 
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 89, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 80, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 2829, in main
    return CLI.main(self)
  File "/usr/lib/python2.7/site-packages/subscription_manager/cli.py", line 160, in main
    return cmd.main()
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 566, in main
    return_code = self._do_command()
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 1515, in _do_command
    self._get_consumer_release()
  File "/usr/lib/python2.7/site-packages/subscription_manager/managercli.py", line 1469, in _get_consumer_release
    consumer = self.cp.getConsumer(self.identity.uuid)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 1014, in getConsumer
    return self.conn.request_get(method)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 614, in request_get
    return self._request("GET", method, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 640, in _request
    info=info, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 529, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 594, in validateResponse
    raise RateLimitExceededException(response['status'])
RateLimitExceededException
2017-05-05 11:37:49,781 [INFO] @subscriptionmanager.py:160 - Sending update in guests lists for config "env/cmdline": 0 guests found

Marking as Verified!!

Comment 10 errata-xmlrpc 2017-08-01 19:18:42 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.

https://access.redhat.com/errata/RHBA-2017:2083


Note You need to log in before you can comment on or make changes to this bug.