some db cursors are not explicitly closed

Bug #158386 reported by Eleanor Berger
4
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Low
Unassigned

Bug Description

Every now and then we need to get a low-leve DB-API cursor (instead of using SQLObject). After we use such a cursor, we should explicitly close it (the effects of neglecting to are unknown to me, but the DB-API documentation indicates that this is mandatory), but there are some places in the code where we don't do that right now.

This bug is for identifying all these places and correcting them.

See, for example: lib/canonical/launchpad/database/branch.py#getScannerData

Changed in launchpad:
assignee: nobody → launchpad
Revision history for this message
Celso Providelo (cprov) wrote :

Hi Tom,

Right, I think it will be clearer that way, but I couldn't find a mention in http://www.python.org/dev/peps/pep-0249/, is it missing or am I not paying enough attention ?

Check the very specific soyuz-callsites:

{{{
lib/canonical/buildmaster/buildergroup.py:386
lib/canonical/archivepublisher/domination.py:326
scripts/ftpmaster-tools/initialise-from-parent.py:152
scripts/ftpmaster-tools/sync-source.py:472
scripts/ftpmaster-tools/sync-source.py:565
}}}

Obviously there are other callsites related to soyuz in launchpad/database but they are more trivial to sort.

The diff attached address these occurrences.

Changed in launchpad:
assignee: launchpad → nobody
Curtis Hovey (sinzui)
Changed in launchpad-foundations:
status: New → Triaged
importance: Undecided → Low
visibility: private → public
Changed in launchpad:
importance: Low → High
Revision history for this message
Robert Collins (lifeless) wrote :

I'm going to downgrade this to low again, having looked at it more - AFAICT we don't have any daemons doing this, and the FDT deployments regularly reset all the DB connections. The DB-API allows for servers that do reserve resources while the cursor is open, which is why it has that requirement. Finally our scripts are moving to be API clients, which eliminates any excuse they have for using cursors directly.

Changed in launchpad:
importance: High → Low
summary: - Close all low-level cursors
+ some db cursors are not explicitly closed
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.