Removing Bug-Task From Project Makes Program Crash

Bug #964886 reported by Eike
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bug-repo-syncer
New
Medium
Unassigned

Bug Description

In Launchpad a bug task can be removed from a project. From the perspective of Bug Repo Syncer, this means that a bug can suddenly disappear. This confuses the program, it raises an exception and crashes. Something similar can happen in Trac too, as bugs can be deleted there.

Therefore the program should be modified so that deleted bugs don't let the program crash.

However the information that the bug has disappeared (the crash) is only available at the end of the algorithm in `write_bugs.write_bugs`. Therefore a sensible reaction needs a second pass of the algorithm.

'''TODO:'''

The architecture of the program should be changed, so so that there is a general framework for bugs that need a second pass through the algorithm, and a framework for bugs that need special treatment. Similar needs arise for the translation of bug links.

The damaged bugs should be at least removed form the internal data structures.

'''Done:'''

The error is caught in `LpController.update_bugs`, `TracController` and `RepoControllerDummy`. Bugs that could not be updated are returned, with their fields `id` and `repo_name` set to the correct values.

'''See:'''

 * TranslateBugLinks
 * https://blueprints.launchpad.net/bug-repo-syncer/+spec/translate-bug-links
 * Bug #970732 (Framework for Second Pass Through Algorithm and for Special Treatment)

This is the traceback:

{{{
Traceback (most recent call last):
  File "/usr/local/bin/bsync", line 31, in <module>
    bsync.main()
  File "/usr/local/lib/python2.7/site-packages/bug_repo_syncer/main.py", line 120, in main
    self.do_sync(cmdinfo)
  File "/usr/local/lib/python2.7/site-packages/bug_repo_syncer/main.py", line 373, in do_sync
    syncer.synchronize_repos(sync_since, dry_run=False)
  File "/usr/local/lib/python2.7/site-packages/bug_repo_syncer/main.py", line 1211, in synchronize_repos
    self.write_bugs(write_tasks)
  File "/usr/local/lib/python2.7/site-packages/bug_repo_syncer/main.py", line 1131, in write_bugs
    new_ids = pipe.upload_queued_bugs()
  File "/usr/local/lib/python2.7/site-packages/bug_repo_syncer/main.py", line 1320, in upload_queued_bugs
    self.repo_controller.update_bugs(self.up_bugs, self.up_ids)
  File "/usr/local/lib/python2.7/site-packages/bug_repo_syncer/repo_io.py", line 968, in update_bugs
    lp_task = self.find_bug_task(lp_bug)
  File "/usr/local/lib/python2.7/site-packages/bug_repo_syncer/repo_io.py", line 921, in find_bug_task
    .format(id=lp_bug.id, proj=self.project.name))
KeyError: "Bug 936502 not in 'bug-repo-syncer'."
}}}

Eike (eike-welk)
Changed in bug-repo-syncer:
milestone: none → 0.3.0
importance: Undecided → Medium
importance: Medium → High
Eike (eike-welk)
Changed in bug-repo-syncer:
status: New → Confirmed
Eike (eike-welk)
description: updated
Eike (eike-welk)
description: updated
Eike (eike-welk)
description: updated
Eike (eike-welk)
description: updated
Changed in bug-repo-syncer:
status: Confirmed → New
importance: High → Medium
milestone: 0.3.0 → 0.4.0
description: updated
Eike (eike-welk)
description: updated
Changed in bug-repo-syncer:
milestone: 0.4.0 → 0.5.0
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.