Bug 196256
| Summary: | [ews-app] Exception while adding a new BuildbotInstance | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Aakash Jain <aakash_jain> |
| Component: | Tools / Tests | Assignee: | Aakash Jain <aakash_jain> |
| Status: | ASSIGNED | ||
| Severity: | Normal | CC: | aakash_jain, ap, lforschler |
| Priority: | P2 | ||
| Version: | Other | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Aakash Jain
While testing ews-app, I noticed following exception in logs.
2019-03-26 5:24:38,657 - Created new buildbot instance id 2 for hostname: AJ-MacBookPro.local
2019-03-26 5:24:38,663 - Created new buildbot instance id 3 for hostname: AJ-MacBookPro.local
2019-03-26 5:24:38,683 - Saved build 2_340 in database for patch_id: 360445
2019-03-26 5:24:38,673 - Internal Server Error: /results/
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Library/Python/2.7/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/Library/Python/2.7/site-packages/django/utils/decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "/Library/Python/2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/Library/Python/2.7/site-packages/django/utils/decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/Library/Python/2.7/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/Users/jain/code1/WebKit/Tools/BuildSlaveSupport/ews-app/ews/views/results.py", line 49, in post
return self.step_event(data)
File "/Users/jain/code1/WebKit/Tools/BuildSlaveSupport/ews-app/ews/views/results.py", line 72, in step_event
state_string=data['state_string'], started_at=data['started_at'], complete_at=data['complete_at'])
File "/Users/jain/code1/WebKit/Tools/BuildSlaveSupport/ews-app/ews/models/step.py", line 58, in save_step
build_uid = BuildbotInstance.get_uid(hostname, build_id)
File "/Users/jain/code1/WebKit/Tools/BuildSlaveSupport/ews-app/ews/models/buildbotinstance.py", line 54, in get_uid
instance_id = BuildbotInstance.get_instance_id(hostname)
File "/Users/jain/code1/WebKit/Tools/BuildSlaveSupport/ews-app/ews/models/buildbotinstance.py", line 45, in get_instance_id
return BuildbotInstance.objects.get(hostname=hostname, active=True).instance_id
File "/Library/Python/2.7/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 384, in get
(self.model._meta.object_name, num)
MultipleObjectsReturned: get() returned more than one BuildbotInstance -- it returned 2!
2019-03-26 15:24:38,730 - Internal Server Error: /results/
It seems from the new host, two events arrived at almost same time, and both accessed the get_instance_id() method, checked that BuildbotInstance entry for that hostname did not exist, and both created a new entry in BuildbotInstance for that host. Subsequent get operations for that host fails with above exception.
Seems like we need locking in this portion of code to properly handle multiple threads.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |