[Bug 1652641] Re: crash in indexer.py, AttributeError: 'NoneType' object has no attribute 'unlink'

Carlo Vanini silhusk at gmail.com
Sat Sep 2 22:25:43 UTC 2017


Hello Simon,

version 0.47ubuntu13 in zesty-updates is still affected.
version 0.47ubuntu8.3 in xenial-updates is affected too.

Artful beta1 has 0.47ubuntu13 like Zesty does, but I could not reproduce
the bug. The reason could be that Python changed from 3.5.3 (in Zesty)
to 3.6.2 (in Artful). The way Python unloads modules might have changed,
but I couldn't tell for sure from the docs
https://docs.python.org/3/whatsnew/3.6.html

Patch updated, as you suggested.

** Patch added: "apt-xapian-index_0.47ubuntu13.1.debdiff"
   https://bugs.launchpad.net/ubuntu/+source/apt-xapian-index/+bug/1652641/+attachment/4943253/+files/apt-xapian-index_0.47ubuntu13.1.debdiff

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to apt-xapian-index in Ubuntu.
https://bugs.launchpad.net/bugs/1652641

Title:
  crash in indexer.py, AttributeError: 'NoneType' object has no
  attribute 'unlink'

Status in apt-xapian-index package in Ubuntu:
  Confirmed

Bug description:
  [Impact]

  When the apt-xapian-index is already up to date, and under certain
  conditions, update-apt-xapian-index throws an exception.

  The index /var/lib/apt-xapian-index is up to date
  Exception ignored in: <bound method ServerProgress.__del__ of
  <axi.indexer.ServerProgress object at 0x7f04a5ae4c18>>
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/axi/indexer.py", line 306, in __del__
  AttributeError: 'NoneType' object has no attribute 'unlink'

  This happens more frequently when it is run with nice and ionice,
  which is the case in the cron.weekly/apt-xapian-index cron job.

  This is not severe, since the exception is thrown on exit, and depends
  on the way python3 cleans up the environment. Anyway, this leaves a
  socket file behind, and creates noise in cron logs (see comment #2).

  The patch keeps a reference to the os.unlink function in the
  ServerProgress instance, such that it has the same lifespan.

  [Test Case]

  * `sudo nice -n 19 ionice -c 3 update-apt-xapian-index --quiet`
  * may need to run 4 times or more
  * no exception is thrown

  [Regression Potential]

  * If the os module is unloaded anyway and self.os_unlink becomes
  unreachable, we get the same exception again.

  [Other Info]

  * There is probably a more "pythonic" way to fix this. For instance,
  avoiding __del__. That requires a larger change.

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



More information about the foundations-bugs mailing list