Closed Bug 809156 Opened 9 years ago Closed 9 years ago

API: using a large integer for "limit" (the number of results returned) causes an ISE (HTTP 500)

Categories

(Participation Infrastructure :: Phonebook, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: mbrandt, Assigned: giorgos)

References

()

Details

Increasing the number of results returned using the api to a large number causes a 500 error.

Steps to reproduce:
1. goto https://mozillians.allizom.org/api/v1/users/?app_name=mozapp&app_key=test&format=json&limit=2000

Expected:
It should not return a 500 error regardless of the limit that is set.

Actual:

--
[11:34:50.311] GET https://mozillians.allizom.org/api/v1/users/?app_name=mozapp&app_key=test&format=json&limit=2000 [HTTP/1.1 500 Internal Server Error 32345ms]
Blocks: 752997
Assignee: nobody → giorgos
Status: NEW → ASSIGNED
I believe that the upstream cache server timeouts before the application server completes rendering this huge response. That's why we get the "Service unavailable" message and no traceback is produced.

I'll work on limiting the maximum number of results returned to something reasonable, e.g. 100 users.

Thanks for reporting!
Commits pushed to master at https://github.com/mozilla/mozillians

https://github.com/mozilla/mozillians/commit/6b4613b04f1439eb6b4c8130e968c33c3853a46c
[fix bug 809156] Limit the number of results per API request.

https://github.com/mozilla/mozillians/commit/8ece09e0dada13d39a0ccb85e01a653ed94bf1b1
Merge pull request #344 from glogiotatidis/api-limit

[fix bug 809156] Limit the number of results per API request.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Hard limit is now set to 500 users, configurable through HARD_API_LIMIT_PER_PAGE in settings.
Verified on stage: seeing the results limit to 2000 successfully (http 200) returns only 500 results.

https://mozillians.allizom.org/api/v1/users/?app_name=mozapp&app_key=test&format=json&limit=2000

{

    "meta": {
        "limit": 500,
        "next": "/api/v1/users/?limit=500&app_name=mozapp&format=json&offset=500&app_key=test",
        "offset": 0,
        "previous": null,
        "total_count": 2402
    },
Status: RESOLVED → VERIFIED
Status: VERIFIED → RESOLVED
Closed: 9 years ago9 years ago
Verified on stage using steps from comment 4 -

https://mozillians.allizom.org/api/v1/users/?app_name=mozapp&app_key=test&format=json&limit=2000


{

    "meta": {
        "limit": 500,
        "next": "/api/v1/users/?limit=500&app_name=mozapp&format=json&offset=500&app_key=test",
        "offset": 0,
        "previous": null,
        "total_count": 2516
    },
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.