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

VERIFIED FIXED

Status

Participation Infrastructure
Phonebook
VERIFIED FIXED
5 years ago
5 years ago

People

(Reporter: mbrandt, Assigned: giorgos)

Tracking

Details

(URL)

(Reporter)

Description

5 years ago
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]

Updated

5 years ago
Blocks: 752997
(Assignee)

Updated

5 years ago
Assignee: nobody → giorgos
Status: NEW → ASSIGNED
(Assignee)

Comment 1

5 years ago
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!

Comment 2

5 years ago
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.

Updated

5 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
(Assignee)

Comment 3

5 years ago
Hard limit is now set to 500 users, configurable through HARD_API_LIMIT_PER_PAGE in settings.
(Reporter)

Comment 4

5 years ago
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

Comment 5

5 years ago
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

Updated

5 years ago
Status: VERIFIED → RESOLVED
Last Resolved: 5 years ago5 years ago
(Reporter)

Comment 6

5 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.