Duplicate Consumers retrieved during authentication

Bug #706035 reported by Anthony Lenton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ratings and Reviews server
Fix Released
High
Łukasz Czyżykowski
Software Center Agent
Fix Released
High
Łukasz Czyżykowski

Bug Description

Environment:

Request Method: POST
Request URL: http://reviews.staging.ubuntu.com/reviews/api/1.0/reviews/
Django Version: 1.1.1
Python Version: 2.6.5
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django_openid_auth',
 'django_configglue',
 'reviewsapp',
 'south']
Installed Middleware:
['django.middleware.cache.UpdateCacheMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.cache.FetchFromCacheMiddleware']

Traceback:
File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py" in get_response
  92. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/pymodules/python2.6/django/views/decorators/vary.py" in inner_func
  21. response = func(*args, **kwargs)
File "/usr/lib/python2.6/dist-packages/piston/resource.py" in __call__
  74. if not self.authentication.is_authenticated(request):
File "/usr/lib/python2.6/dist-packages/reviewsapp/auth.py" in is_authenticated
  78. return super(SSOOAuthAuthentication, self).is_authenticated(request)
File "/usr/lib/python2.6/dist-packages/piston/authentication.py" in is_authenticated
  226. consumer, token, parameters = self.validate_token(request)
File "/usr/lib/python2.6/dist-packages/reviewsapp/auth.py" in validate_token
  120. return oauth_server.verify_request(oauth_request)
File "/usr/lib/python2.6/dist-packages/oauth/oauth.py" in verify_request
  433. consumer = self._get_consumer(oauth_request)
File "/usr/lib/python2.6/dist-packages/oauth/oauth.py" in _get_consumer
  481. consumer = self.data_store.lookup_consumer(consumer_key)
File "/usr/lib/python2.6/dist-packages/reviewsapp/models/oauthtoken.py" in lookup_consumer
  161. consumer = Consumer.objects.get(key=consumer_key)
File "/usr/lib/pymodules/python2.6/django/db/models/manager.py" in get
  120. return self.get_query_set().get(*args, **kwargs)
File "/usr/lib/pymodules/python2.6/django/db/models/query.py" in get
  307. % (self.model._meta.object_name, num, kwargs))

Exception Type: MultipleObjectsReturned at /reviews/api/1.0/reviews/
Exception Value: get() returned more than one Consumer -- it returned 2! Lookup parameters were {'key': '6ehHBGz'}

QA Notes:
Verified this by watching the log on the server and seeing:
2011-03-23 15:14:08,587 - reviewsapp.models.oauthtoken - INFO - consumer_key=QBbQpLf has 2 entries in the database
but without hitting an error.

Related branches

Changed in rnr-server:
status: New → Confirmed
importance: Undecided → Medium
Changed in software-center-agent:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Anthony Lenton (elachuni) wrote :

This happened again this week on the rnr vps: https://pastebin.canonical.com/44596/

tags: added: kb-defect
Changed in rnr-server:
importance: Medium → High
Changed in rnr-server:
assignee: nobody → Łukasz Czyżykowski (lukasz-czyzykowski)
status: Confirmed → In Progress
Changed in software-center-agent:
assignee: nobody → Łukasz Czyżykowski (lukasz-czyzykowski)
status: Confirmed → In Progress
Changed in rnr-server:
status: In Progress → Fix Committed
Changed in software-center-agent:
status: In Progress → Fix Committed
description: updated
Revision history for this message
Dave Morley (davmor2) wrote :

Anthony agreed that this was very hard to reproduce under normal testing so the end user would struggle to reproduce this.

To that end we have marked it as qa-untestable

tags: added: qa-untestable
Changed in rnr-server:
status: Fix Committed → Fix Released
Changed in software-center-agent:
status: Fix Committed → Fix Released
Changed in rnr-server:
milestone: none → 11.03
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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