FuzzManager
FuzzManager copied to clipboard
[Collector][CrashManager] MultipleObjectsReturned: get() returned more than one Product -- it returned 2!
[Mon Oct 30 05:10:56.021729 2017] [wsgi:error] [pid 12:tid 140702473750272] Internal Server Error: /crashmanager/rest/crashes/ [Mon Oct 30 05:10:56.021740 2017] [wsgi:error] [pid 12:tid 140702473750272] Traceback (most recent call last): [Mon Oct 30 05:10:56.021747 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 41, in inner [Mon Oct 30 05:10:56.021753 2017] [wsgi:error] [pid 12:tid 140702473750272] response = get_response(request) [Mon Oct 30 05:10:56.021768 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 249, in _legacy_get_response [Mon Oct 30 05:10:56.021775 2017] [wsgi:error] [pid 12:tid 140702473750272] response = self._get_response(request) [Mon Oct 30 05:10:56.021783 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 187, in _get_response [Mon Oct 30 05:10:56.021790 2017] [wsgi:error] [pid 12:tid 140702473750272] response = self.process_exception_by_middleware(e, request) [Mon Oct 30 05:10:56.021797 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 185, in _get_response [Mon Oct 30 05:10:56.021805 2017] [wsgi:error] [pid 12:tid 140702473750272] response = wrapped_callback(request, *callback_args, **callback_kwargs) [Mon Oct 30 05:10:56.021812 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/csrf.py", line 58, in wrapped_view [Mon Oct 30 05:10:56.021818 2017] [wsgi:error] [pid 12:tid 140702473750272] return view_func(*args, **kwargs) [Mon Oct 30 05:10:56.021824 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/usr/local/lib/python2.7/dist-packages/rest_framework/viewsets.py", line 90, in view [Mon Oct 30 05:10:56.021830 2017] [wsgi:error] [pid 12:tid 140702473750272] return self.dispatch(request, *args, **kwargs) [Mon Oct 30 05:10:56.021841 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/usr/local/lib/python2.7/dist-packages/rest_framework/views.py", line 489, in dispatch [Mon Oct 30 05:10:56.021847 2017] [wsgi:error] [pid 12:tid 140702473750272] response = self.handle_exception(exc) [Mon Oct 30 05:10:56.021853 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/usr/local/lib/python2.7/dist-packages/rest_framework/views.py", line 449, in handle_exception [Mon Oct 30 05:10:56.021859 2017] [wsgi:error] [pid 12:tid 140702473750272] self.raise_uncaught_exception(exc) [Mon Oct 30 05:10:56.021865 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/usr/local/lib/python2.7/dist-packages/rest_framework/views.py", line 486, in dispatch [Mon Oct 30 05:10:56.021871 2017] [wsgi:error] [pid 12:tid 140702473750272] response = handler(request, *args, **kwargs) [Mon Oct 30 05:10:56.021877 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/usr/local/lib/python2.7/dist-packages/rest_framework/mixins.py", line 21, in create [Mon Oct 30 05:10:56.021885 2017] [wsgi:error] [pid 12:tid 140702473750272] self.perform_create(serializer) [Mon Oct 30 05:10:56.021892 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/usr/local/lib/python2.7/dist-packages/rest_framework/mixins.py", line 26, in perform_create [Mon Oct 30 05:10:56.021899 2017] [wsgi:error] [pid 12:tid 140702473750272] serializer.save() [Mon Oct 30 05:10:56.021905 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/usr/local/lib/python2.7/dist-packages/rest_framework/serializers.py", line 215, in save [Mon Oct 30 05:10:56.021918 2017] [wsgi:error] [pid 12:tid 140702473750272] self.instance = self.create(validated_data) [Mon Oct 30 05:10:56.021925 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/web/server/crashmanager/serializers.py", line 53, in create [Mon Oct 30 05:10:56.021933 2017] [wsgi:error] [pid 12:tid 140702473750272] attrs['product'] = Product.objects.get_or_create(**attrs['product'])[0] [Mon Oct 30 05:10:56.021939 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 85, in manager_method [Mon Oct 30 05:10:56.021946 2017] [wsgi:error] [pid 12:tid 140702473750272] return getattr(self.get_queryset(), name)(*args, **kwargs) [Mon Oct 30 05:10:56.021952 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 464, in get_or_create [Mon Oct 30 05:10:56.021958 2017] [wsgi:error] [pid 12:tid 140702473750272] return self.get(**lookup), False [Mon Oct 30 05:10:56.021964 2017] [wsgi:error] [pid 12:tid 140702473750272] File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 384, in get [Mon Oct 30 05:10:56.021970 2017] [wsgi:error] [pid 12:tid 140702473750272] (self.model._meta.object_name, num) [Mon Oct 30 05:10:56.021975 2017] [wsgi:error] [pid 12:tid 140702473750272] MultipleObjectsReturned: get() returned more than one Product -- it returned 2!
As mentioned in #386:
I think it occurs when no product is specified in the request. We should add a check in Collector
for this, and also return a more meaningful error from the server.