crashed when submiting a request

Bug #690695 reported by Michael Vogt
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ratings and Reviews server
Fix Released
Medium
Michael Nelson

Bug Description

It just crashed for me with the following BT when submitting a review for 7zip:

Piston/0.2.2 (Django 1.1.1) crash report:

Traceback (most recent call last):

  File "/usr/lib/python2.6/dist-packages/reviewsapp/api/handlers.py", line 111, in create
    if not form.is_valid():

  File "/usr/lib/pymodules/python2.6/django/forms/forms.py", line 120, in is_valid
    return self.is_bound and not bool(self.errors)

  File "/usr/lib/pymodules/python2.6/django/forms/forms.py", line 111, in _get_errors
    self.full_clean()

  File "/usr/lib/pymodules/python2.6/django/forms/forms.py", line 250, in full_clean
    self.cleaned_data = self.clean()

  File "/usr/lib/python2.6/dist-packages/reviewsapp/forms.py", line 88, in clean
    self._validate_and_populate_software_item()

  File "/usr/lib/python2.6/dist-packages/reviewsapp/forms.py", line 115, in _validate_and_populate_software_item
    package_name=package_name, app_name=app_name)

  File "/usr/lib/pymodules/python2.6/django/db/models/manager.py", line 120, in get
    return self.get_query_set().get(*args, **kwargs)

  File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line 307, in get
    % (self.model._meta.object_name, num, kwargs))

MultipleObjectsReturned: get() returned more than one SoftwareItem -- it returned 2! Lookup parameters were {'app_name': u'7zip', 'package_name': u'p7zip-full'}

Tags: trivial
Revision history for this message
Michael Nelson (michael.nelson) wrote :

I just checked via the admin interface and the two software items of 7zip were created at the same time. Looking at the code, AFAICS, this is because of a race condition:

 * If software item does not exist locally
   1) Check with LP to ensure it is exists in repository (takes time)
   2) Create software item

If (1) above is taking a while, and the user resubmits the review via the SC-client, then both requests can end up creating the software item.

If this is the case, we can fix this trivially in the server. The issue is that the Software Center client correctly disables the Publish button for a review while it is talking with the server, so the above reproduction steps would only be possible if that is a recent change since this bug was created.

Revision history for this message
Michael Nelson (michael.nelson) wrote :

11:25 <noodles> Hi! I'm just trying to reproduce https://bugs.launchpad.net/rnr-server/+bug/690695
11:26 <noodles> It's great that the Publish button is disabled when you submit a review - but has it always been that way? Is it possible that when the bug was created it was possible to click publish again while the first one was still being processed?
11:37 <mvo> indeed, that is possible. what about if two people submit a review for a sofware-item at the same time (when there was no previous one there). would that trigger the bug as well? as this is probably a common scenario
11:37 <mvo> at least initially
11:38 <noodles> Yes, true, it would. I've just pushed a fix for the server.
11:38 <mvo> great, thanks!
11:38 <mvo> its quite likely that the client did not disable properly or even accidently send the review twice
11:39 <noodles> Cool, thanks!

Changed in rnr-server:
status: New → In Progress
assignee: nobody → Michael Nelson (michael.nelson)
Changed in rnr-server:
importance: Undecided → Medium
tags: added: trivial
Changed in rnr-server:
status: In Progress → Fix Committed
Revision history for this message
Dave Morley (davmor2) wrote :

This isn't happening to me when submitting reviews

Changed in rnr-server:
milestone: none → 10.12
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.