Crash due to HTTP 410 error retrieving non-existent person

Bug #1203154 reported by Steve Magoun
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bugtimetracker
New
Undecided
Unassigned

Bug Description

bugtimetracker crashed while importing data from the 'cloudberry' project. This project contains a bug (bug 440760) that references a user that is no longer in launchpad (~cody-cody-somerville). Looks like we need an extra level of exception handling, or less-strict exception handling to catch this case.

Code in question:

                    try:
                        old_assignee = (session.query(Person)
                                        .filter_by(name=name).one())
                    except NoResultFound:
                        try:
                            lp_assignee = self.launchpad.people(name)
                            old_assignee = Person(lp_assignee.name, <--- crashes here
                                                  lp_assignee.display_name,
                                                  lp_assignee.is_team)
                        except NotFound:
                            logging.warning('Assignee not found '
                                            'in launchpad: {0}'
                                            .format(name))
                            old_assignee = Person(name, display_name)

Debug output from bugtimetracker:

https://api.launchpad.net/1.0/bugs/440760/activity
DEBUG: Processing entry: 2010-05-10 10:27:49.985875, u'cloudberry: status', u'Fix Released', u'Fix Committed'
DEBUG: Attribute changed: u'cloudberry', None, u'status'
DEBUG: u'status' updated from u'Fix Released' to u'Fix Committed'
DEBUG: Processing entry: 2010-04-30 05:22:10.832638, u'cloudberry: assignee', u'Cody A.W. Somerville (cody-somerville)', u'Cody A.W. Somerville (cody-cody-somerville)'
DEBUG: Attribute changed: u'cloudberry', None, u'assignee'
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.7/dist-packages/bugtimetracker/dialog.py", line 116, in update_target
    if not cancel_event.is_set()])
  File "/usr/lib/python2.7/dist-packages/bugtimetracker/dialog.py", line 104, in run_update
    self.bugs_progressbar)
  File "/usr/lib/python2.7/dist-packages/bugtimetracker/db/update.py", line 63, in update
    bug_updater.update()
  File "/usr/lib/python2.7/dist-packages/bugtimetracker/db/update.py", line 163, in update
    lp_entry, match)
  File "/usr/lib/python2.7/dist-packages/bugtimetracker/db/update.py", line 371, in _handle_attribute_change
    old_assignee = Person(lp_assignee.name,
  File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/resource.py", line 705, in __getattr__
    return super(Entry, self).__getattr__(name)
  File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/resource.py", line 335, in __getattr__
    return self.lp_get_parameter(attr)
  File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/resource.py", line 219, in lp_get_parameter
    self._ensure_representation()
  File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/resource.py", line 361, in _ensure_representation
    representation = self._root._browser.get(self._wadl_resource)
  File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/_browser.py", line 411, in get
    response, content = self._request(url, extra_headers=headers)
  File "/usr/lib/python2.7/dist-packages/lazr/restfulclient/_browser.py", line 401, in _request
    raise error
ClientError: HTTP Error 410: Gone

Revision history for this message
Steve Magoun (smagoun) wrote :

In the snippet above, changing 'except NotFound' to 'except' was enough to fix the error in my testing.

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.