Skip to content

Infinite recursion for 429 Too Many Requests #189

@jmoldow

Description

@jmoldow

BoxSession._retry_request_if_necessary() (https://github.com/box/box-python-sdk/blob/6597e93/boxsdk/session/box_session.py#L235) has logic for retrying the request in the event of a Box site issue (HTTP 500 responses) or heavy load on Box (HTTP 429 rate limiting responses).

For HTTP 500s, we only make up to 10 attempts, and after the 10th failure, we'll raise an exception.

For HTTP 429s, however, we make potentially an infinite number of retries.

The method is also recursive. This can lead to RuntimeError: maximum recursion depth exceeded being raised.

This should be changed so that HTTP 429s also have a finite number of retries.

(In theory, we could also make the function iterative, instead of recursive, to get around the recursion depth problem. However, in the case of a persistent issue, the SDK should probably return control back to the caller, instead of looping endlessly.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions