PerformanceDatumViewSet.list "ValueError: invalid literal for int() with base 10: ..."

RESOLVED FIXED

Status

Tree Management
Perfherder
P2
normal
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: emorley, Assigned: ShrutiJ)

Tracking

(Blocks: 1 bug)

Details

Attachments

(2 attachments)

We should handle this case gracefully (with an HTTP 400) not HTTP 500.

/treeherder.webapp.api.performance_data:PerformanceDatumViewSet.list

File "/app/treeherder/webapp/api/performance_data.py", line 185, in list
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 679, in filter
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 697, in _filter_or_exclude
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1310, in add_q
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1338, in _add_q
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1209, in build_filter
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/query.py", line 1102, in build_lookup
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/lookups.py", line 105, in __init__
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/lookups.py", line 143, in get_prep_lookup
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 1875, in get_prep_lookup
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 729, in get_prep_lookup
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 1869, in get_prep_value
 exceptions:ValueError: invalid literal for int() with base 10: 'http://8948474958936717641.owasp.org' 

/api/project/mozilla-inbound/performance/data/

parameters	
job_id   	http://8948474958936717641.owasp.org
We should check that the job_id parameter is an integer here, and return a sensible error if it isn't:

https://github.com/mozilla/treeherder/blob/master/treeherder/webapp/api/performance_data.py#L173
(Assignee)

Comment 3

2 years ago
:wlach, I'll work on this bug.
(Assignee)

Updated

2 years ago
Assignee: nobody → shrutijasoria1996
Created attachment 8828925 [details] [review]
[treeherder] SJasoria:Bug_1311982 > mozilla:master
(Assignee)

Comment 5

2 years ago
Comment on attachment 8828925 [details] [review]
[treeherder] SJasoria:Bug_1311982 > mozilla:master

I've made a few changes. Please take a look.
Attachment #8828925 - Flags: review?(wlachance)
Comment on attachment 8828925 [details] [review]
[treeherder] SJasoria:Bug_1311982 > mozilla:master

Left some comments. Please re-r? when feedback is addressed. :)
Attachment #8828925 - Flags: review?(wlachance)
(Assignee)

Comment 7

2 years ago
Comment on attachment 8828925 [details] [review]
[treeherder] SJasoria:Bug_1311982 > mozilla:master

Made the changes which you had asked for in the PR. I've written a test too. I hope it's good.
Attachment #8828925 - Flags: feedback?(wlachance)
Comment on attachment 8828925 [details] [review]
[treeherder] SJasoria:Bug_1311982 > mozilla:master

Left some comments on github!
Attachment #8828925 - Flags: feedback?(wlachance)
(Assignee)

Comment 9

2 years ago
Comment on attachment 8828925 [details] [review]
[treeherder] SJasoria:Bug_1311982 > mozilla:master

I've made the required changes. I hope it's good now.
Attachment #8828925 - Flags: review?(wlachance)
Comment on attachment 8828925 [details] [review]
[treeherder] SJasoria:Bug_1311982 > mozilla:master

Just needs one small change, pre-emptively r+'ing.
Attachment #8828925 - Flags: review?(wlachance) → review+

Comment 11

2 years ago
Commit pushed to master at https://github.com/mozilla/treeherder

https://github.com/mozilla/treeherder/commit/5ec35f62d0f152688dcdd9ea346faed044e29dad
Bug 1311982 - Handle PerformanceDatumViewSet.list error more gracefully (#2090)
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
Unfortunately this actually broke production. :( Apologies, I should have asked for a unit test to make sure this also worked in the normal case. I'll do up a followup.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Created attachment 8830030 [details] [review]
[treeherder] wlach:1311982-take2 > mozilla:master
Status: REOPENED → RESOLVED
Last Resolved: 2 years ago2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.