Logic in rest_client.py is incorrect

Bug #1093573 reported by Rajalakshmi Ganesan
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
Rajalakshmi Ganesan

Bug Description

The code in rest_client.py related to 413 error code seems to be incorrect. Following is the logic when return code for request is 413:

if resp.status == 413:
            resp_body = self._parse_resp(resp_body)
            self._log(req_url, body, resp, resp_body)
            if 'overLimit' in resp_body:
                raise exceptions.OverLimit(resp_body['overLimit']['message'])
            elif 'limit' in resp_body['message']:
                raise exceptions.OverLimit(resp_body['message'])
            elif depth < MAX_RECURSION_DEPTH:
                delay = resp['Retry-After'] if 'Retry-After' in resp else 60
                return self.request(method, url, headers, body, depth + 1)
                raise exceptions.RateLimitExceeded(

I understand the first two conditions ['overLimit' in resp_body] and ['limit' in resp_body['message']] are for the sake of confirming if the 413 code is due to “Absolute Limit exception”. But, even when rate-limit exception is encountered, the response body has word “rate-limited” in the message (implies word limit is present in message).

Thus No Retry is occurring when rate-limit is encountered. The flow gets stopped at second condition itself.

Hence removal of condition second condition (that checks "limit"word in response mesage) would be appropriate. Due to this logic in rest_client.py, tests script that encounters rate-limit fails in the first attempt without re-try.

Revision history for this message
Rajalakshmi Ganesan (rajalakshmi-ganesan) wrote :
Changed in tempest:
assignee: nobody → Rajalakshmi Ganesan (rajalakshmi-ganesan)
status: New → Confirmed
Jay Pipes (jaypipes)
Changed in tempest:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tempest (master)

Fix proposed to branch: master
Review: https://review.openstack.org/18655

Changed in tempest:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tempest (master)

Reviewed: https://review.openstack.org/18655
Committed: http://github.com/openstack/tempest/commit/a72ee9a88813b35dfde76f3043932532d5500de7
Submitter: Jenkins
Branch: master

commit a72ee9a88813b35dfde76f3043932532d5500de7
Author: rajalakshmi-ganesan <email address hidden>
Date: Wed Dec 26 15:03:27 2012 +0530

    Logic in rest_client incorrect "resp.status=413"

    rest_client is NOT redriving rate limited calls for the second time.
    When 413 error code is encountered for a request, it checks for the
    word "overLimit" and "limit" in resp_body and resp_body[message]
    respectively so as to confirm if it is a absolute-limited call.
    If absolute limited call is confirmed, OverLimit exception is raised
    without any re-try for request.
    Then comes the check for depth < MAX_RECURSION_DEPTH, if it is true,
    re-drive towards request call occurs.
    But, the word "limit" also appears in the message of ratelimited call.
    Hence it is incorrect to raise OverLimit exception without re-try when
    word "limit" is present in the message of response.
    Thus changed the word to "exceeded" instead of "limit".
    Fixes: bug #1093573

    Change-Id: Iadd94c18668096d7e4795631337230ec36e9c4b9

Changed in tempest:
status: In Progress → Fix Released
Sean Dague (sdague)
Changed in tempest:
milestone: none → havana-3
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.