Comment 6 for bug 1652641

Revision history for this message
Carlo Vanini (silhusk) wrote :

It looks like the same bug reappearing https://bugs.launchpad.net/ubuntu/+source/apt-xapian-index/+bug/1530518/comments/2

Running a-x-i directly doesn't trigger this bug, but the combination of nice and ionice makes it show up much more often. (When the index is already up to date)

Steps to reproduce:
 * `sudo update-apt-xapian-index`
 * Now that the index is updated we trigger the bug by running the following command (which is the same used in the cron job)
 * `sudo nice -n 19 ionice -c 3 update-apt-xapian-index --quiet`
 * may need to run 4 times or more

The intention of the proposed patch is to work around the problem by keeping a reference to the os.unlink function in the ServerProgress instance.
See http://stackoverflow.com/questions/17084260/imported-modules-become-none-when-running-a-function for an explanation of the issue in python.
Also see http://pydev.blogspot.ch/2015/01/creating-safe-cyclic-reference.html for a possible implementation using weakrefs.