Closed Bug 1281808 Opened 8 years ago Closed 8 years ago

exceptions:KeyError: 'summary' in BugzillaViewSet.create_bug

Categories

(Tree Management :: Treeherder: API, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: KWierso)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

https://rpm.newrelic.com/accounts/677903/applications/4180461/traced_errors/3fca17-4c1da741-3951-11e6-bd66-b82a72d22a14

Traceback (most recent call last):
File "/data/www/treeherder.mozilla.org/venv/bin/gunicorn", line 14, in <module>
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/gunicorn/app/base.py", line 192, in run
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/gunicorn/app/base.py", line 72, in run
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/gunicorn/arbiter.py", line 198, in run
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/gunicorn/arbiter.py", line 524, in manage_workers
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/gunicorn/arbiter.py", line 590, in spawn_workers
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/gunicorn/arbiter.py", line 557, in spawn_worker
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/gunicorn/workers/base.py", line 132, in init_process
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 124, in run
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 68, in run_for_one
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 30, in accept
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 135, in handle
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/newrelic-2.66.0.49/newrelic/api/web_transaction.py", line 1342, in _nr_wsgi_application_wrapper_
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/newrelic-2.66.0.49/newrelic/api/web_transaction.py", line 1228, in _nr_wsgi_application_wrapper_
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 189, in __call__
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/newrelic-2.66.0.49/newrelic/hooks/framework_django.py", line 503, in wrapper
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/rest_framework/viewsets.py", line 87, in view
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/newrelic-2.66.0.49/newrelic/hooks/component_djangorestframework.py", line 27, in _nr_wrapper_APIView_dispatch_
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/rest_framework/views.py", line 466, in dispatch
File "/data/www/treeherder.mozilla.org/venv/lib/python2.7/site-packages/rest_framework/views.py", line 463, in dispatch
File "/data/www/treeherder.mozilla.org/treeherder-service/treeherder/webapp/api/bugzilla.py", line 33, in create_bug
 exceptions:KeyError: 'summary' 

https://github.com/mozilla/treeherder/blob/5d4b9ecb5568b41fc2bf41a261fb28305611adff/treeherder/webapp/api/bugzilla.py#L33
Flags: needinfo?(wkocher)
The issue is that the create_bug API assumes all properties will be present, and doesn't try-catch and return an invalid response if things are missing.

In addition, it seems like the UI is missing the summary in some cases.
Assignee: nobody → wkocher
Flags: needinfo?(wkocher)
Comment on attachment 8764752 [details] [review]
[treeherder] KWierso:1281808 > mozilla:master

Wonder if this would be sufficient?

Also, is there any way to log to the server the instances where it's passing an empty summary? I just tried to file a bug with the summary line blank and I got an error returned from the bugzilla api saying "You must enter a summary for this bug." returned to the UI and displayed.
Attachment #8764752 - Flags: review?(emorley)
> I just tried to file a bug with the summary line blank and I got an error returned from the bugzilla api saying "You must enter a summary for this bug." returned to the UI and displayed.

Without this patch on production treeherder, to be clear.
Attachment #8764752 - Flags: review?(emorley) → review-
Comment on attachment 8764752 [details] [review]
[treeherder] KWierso:1281808 > mozilla:master

So, this?
Attachment #8764752 - Flags: review- → review?(emorley)
Attachment #8764752 - Flags: review?(emorley) → review+
Commit pushed to master at https://github.com/mozilla/treeherder

https://github.com/mozilla/treeherder/commit/86a078e12d3906899499c77459eeab8a1efc7555
Bug 1281808 - Help prevent keyErrors from happening when parameters aren't passed to the bugzilla api endpoint (#1616) r=emorley

This also changes the name of a parameter sent from the UI to the API to
help avoid confusion.
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: