BugzillaAPI.setLaunchpadBugId starts a transaction

Bug #564574 reported by Gavin Panella
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Gavin Panella

Bug Description

It fetches the bug from the database so it can calculate the canonical
URL for it. However, code in the externalbugtracker module is
forbidden from starting transactions.

OOPS-1566CCW1529

The OOPS above is interesting because it's caused by a weird
interaction. The definition of BugzillaAPI.setLaunchpadBugId() is as
follows:

    @ensure_no_transaction
    @needs_authentication
    def setLaunchpadBugId(self, remote_bug, launchpad_bug_id):
        ...
        launchpad_bug = getUtility(IBugSet).get(launchpad_bug_id)
        ...
        self.xmlrpc_proxy.Bug.update_see_also(...)

ensure_no_transaction() checks that there is no transaction before
calling the wrapped function. needs_authentication() calls the wrapped
function, catches errors relating to authentication and then tries to
authenticate before calling the function again.

What happens is:

 * setLaunchpadBugId() is called. There is no transaction is progress,
   so it proceeds normally.

 * The line starting "launchpad_bug = " starts a transaction.

 * The call to update_see_also() fails because authentication is
   needed. needs_authentication() catches this and calls
   _authenticate().

 * _authenticate() is wrapped with ensure_no_transaction(), which
   raises a TransactionInProgress exception.

Related branches

Gavin Panella (allenap)
Changed in malone:
assignee: nobody → Gavin Panella (allenap)
milestone: none → 10.04
status: Triaged → In Progress
Gavin Panella (allenap)
tags: added: qa-untestable
Deryck Hodge (deryck)
Changed in malone:
status: In Progress → Fix Committed
Curtis Hovey (sinzui)
Changed in malone:
status: Fix Committed → Fix Released
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.