I ran into this bug today while cleaning up my system for an upgrade to
quantal (it actually dup'd me on bug #894314 since it was oneconf
crashing). I was running: apt-get purge package_name; relatively
quickly.

This seems like a minimal reproducer in python:

import apt

while True:
  apt_cache = apt.Cache()

It will eventually consume all of the file descriptors and crash with
the above SystemError. I was not really successful in reproducing with
straight apt_pkg, though apt_pkg.PackageRecords(self._cache) seems to be
the line opening the files. It seems like the issue is that the objects
are not being garbage collected fast enough. If,

gc.collect()

is run each loop it seems oscillate between 59 and 114 fds, instead of
increasing rapidly until python runs out. Even better is:

del apt_cache._records

which oscillates between 3 and 59 fds. So a fix might be to add an
explicit close() method to apt.Cache which deletes at least the _records
object, and perhaps other objects.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1051935

Title:
  Fails with SystemError when too many files are open

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-apt/+bug/1051935/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to