Closed Bug 1287140 Opened 8 years ago Closed 8 years ago

Browsing the /jobdetail/ endpoint times out

Categories

(Tree Management :: Treeherder: API, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wlach, Assigned: wlach)

Details

Attachments

(1 file)

Because we're not constraining the scope of the filtering to the few properties we care about, you can filter on any of the fields in job details, including the foreign key to the jobs table. 

Unfortunately the default behaviour of django rest framework's browsable api viewer is to get *every* element of the foreign key for display in the "filtering options" dialog with this enabled, which is completely insane. This causes the /jobdetail/ endpoint to hang (and probably a bunch of crazy SQL queries to gum up treeherder production).

We can fix this problem by restricting the set of fields that can be filtered to the ones that we explicitly specify, which fixes the root cause.

I'll try to find the time to at least file an issue with djangorestframework to change the behaviour in the filtering view as well. IMO it should only provide a form to let people pass an integer reference to the foreign key relation in the filtering panel, nothing more.
Attachment #8771463 - Flags: review?(emorley)
Attachment #8771463 - Flags: review?(emorley) → review+
Commit pushed to master at https://github.com/mozilla/treeherder

https://github.com/mozilla/treeherder/commit/c4e601450f7abe62b28527d7a57211e703928452
Bug 1287140 - Restrict job detail filters to a small set (#1694)

We were allowing filtering on any of the model's properties, which caused
djangorestframework to try and render some ridiculous things in the browsable
api renderer (including an option form with every single job in treeherder)
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: