requests-arcgis-auth icon indicating copy to clipboard operation
requests-arcgis-auth copied to clipboard

OverflowError in 64-bit python when response payload is large

Open pfoppe opened this issue 4 years ago • 1 comments

The authentication handler attempts to check the response for an expired token to re-generate if needed.
If the response content is large, python may throw an "OverflowError" which suggests a memory related issue.

File ... arcgis_saml_auth.py line 255, in _handle_response if resp.json().get("error") is not None: ... File ... sjisprober.py, line 54 in feed for i in range(0, aLen): OverflowError: range() result has too many items

The URL call where this failed reported a content-length of 2578621883

pfoppe avatar Jul 20 '20 21:07 pfoppe

Possible fix is to add the following code to ArcGIS_saml_auth.py at line 275:

        # Unable to parse JSON data due to a memory error.  Requestor could ask for a large payload that is not JSON response.  Throw away exception for now and assume the token was still valid.
        except OverflowError:
            pass

pfoppe avatar Jul 20 '20 21:07 pfoppe