/usr/sbin/update-apt-xapian-index:ImportError:/usr/sbin/update-apt-xapian-index@104:setupIndexing:__init__:__init__:load_source:_load:_load_unlocked:exec_module:_call_with_frames_removed:/usr/share/apt-xapian-index/plugins/software_center.py@13:/usr/share/software-center/softwarecenter/db/update.py@33:/usr/share/software-center/softwarecenter/backend/scagent.py@26

Bug #1526450 reported by errors.ubuntu.com bug bridge
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
software-center (Ubuntu)
Fix Released
High
Barry Warsaw

Bug Description

The Ubuntu Error Tracker has been receiving reports about a problem regarding apt-xapian-index. This problem was most recently seen with version 0.47ubuntu3, the problem page at https://errors.ubuntu.com/problem/566bc9ef6d2e012799374ef01395d6bf864ef8a2 contains more details.

Related branches

Changed in apt-xapian-index (Ubuntu):
assignee: nobody → Barry Warsaw (barry)
importance: Undecided → High
tags: added: rls-x-incoming
Revision history for this message
Barry Warsaw (barry) wrote :

This is gonna be fun. software-center needs some bilingual support even if it's going away in 16.04 and even though it was once ported to Python 3. :( Stay tuned.

Changed in apt-xapian-index (Ubuntu):
status: New → Confirmed
Barry Warsaw (barry)
Changed in apt-xapian-index (Ubuntu):
status: Confirmed → In Progress
Changed in software-center (Ubuntu):
status: New → In Progress
importance: Undecided → High
assignee: nobody → Barry Warsaw (barry)
Revision history for this message
Barry Warsaw (barry) wrote :

This actually isn't caused by a-x-i, so I'm going to remove its bug task. (It did reveal a minor unrelated bug in a-x-i for which I'll upload a fix though.)

I have a patch for s-c that I need to do just a little more testing on.

no longer affects: apt-xapian-index (Ubuntu)
Revision history for this message
Iain Lane (laney) wrote :

Uploading, since the fix looks good and this breaks image builds :(

Revision history for this message
Iain Lane (laney) wrote :

laney@raleigh> sudo PYTHONDONTWRITEBYTECODE=1 /usr/sbin/update-apt-xapian-index --force --quiet
Exception ignored in: <bound method ServerProgress.__del__ of <axi.indexer.ServerProgress object at 0x7f79fe963f28>>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/axi/indexer.py", line 306, in __del__
TypeError: 'NoneType' object is not callable

Barry, could you look at this please? This is what live-build calls and it's spitting out this exception for me (although it's ignored so not that harmful).

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package software-center - 13.10-0ubuntu13

---------------
software-center (13.10-0ubuntu13) xenial; urgency=medium

  * debian/patches/python2-3-compatible.patch: Be compatible with both python
    2 and 3 in pieces used by the a-x-i plugin, so that we can work with that
    now that is has been ported to py3. Patch mostly by Barry Warsaw, thanks!
    (LP: #1526450)

 -- Iain Lane <email address hidden> Wed, 16 Dec 2015 10:16:11 +0000

Changed in software-center (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Barry Warsaw (barry) wrote : Re: [Bug 1526450] Re: /usr/sbin/update-apt-xapian-index:ImportError:/usr/sbin/update-apt-xapian-index@104:setupIndexing:__init__:__init__:load_source:_load:_load_unlocked:exec_module:_call_with_frames_removed:/usr/share/apt-xapian-index/plugins/software_center.py@13:/usr/share/software-center/softwarecenter/db/update.py@33:/usr/share/software-center/softwarecenter/backend/scagent.py@26

On Dec 16, 2015, at 11:07 AM, Iain Lane wrote:

Thanks for fixing the other binary open. I saw that while I was testing but
forgot to come back to it.

>laney@raleigh> sudo PYTHONDONTWRITEBYTECODE=1 /usr/sbin/update-apt-xapian-index --force --quiet
>Exception ignored in: <bound method ServerProgress.__del__ of <axi.indexer.ServerProgress object at 0x7f79fe963f28>>
>Traceback (most recent call last):
> File "/usr/lib/python3/dist-packages/axi/indexer.py", line 306, in __del__
>TypeError: 'NoneType' object is not callable

I saw this one too, and another related traceback:

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'

Note that this one is complaining that the os module has no unlink()
function. Both of these happen in ServerProgress.__del__() and are seen at
process shutdown time. When Python exits, it goes through a rather
complicated dance to finalize and free things, including assigning module
attributes to None first to break loops and free references, before coming
back and destroying the module objects. But there are no ordering
guarantees.

__del__() is notorious for seeing problems like this, and it's clear a
ServerProgress object is surviving until module finalization. When its
__del__() gets called, it's likely the os module (and very possibly others)
have been None-ified, leading to this exception.

Another thing I've noticed is that in update-apt-xapian-index, it grabs a lock
but the lock is never explicitly released. lock() is also the place where the
ServerProgress object gets created. So the code is expecting that process
exit is also releasing the lock, which is reasonable.

To be completely clean, I think u-a-x-i should explicitly call something like
an unlock method that would both release the lockf and cleanly destroy the
ServerProgress object, ensuring its __del__() would get called before Python's
finalization process.

OTOH, given that this happens at process shutdown, it's probably harmless, and
given that it doesn't seem like upstream a-x-i is getting much love in Debian,
I'm inclined to hold my nose and ignore this. If you disagree though, let me
know and it probably wouldn't be too difficult to whip up something cleaner.
What's another Ubuntu delta in the scheme of things? :)

Revision history for this message
C. Jeffery Small (loyhz2ay-jeff-h670zbts) wrote :

FYI: I really know little about this issue, but I upgraded to Xubuntu 16.04 about six weeks ago and received this error report from anacron last night. I never saw this on earlier releases, and this is the first time it has occurred since the upgrade. After researching the error message, I thought I would post this here as it may indicate that the bug persists. Regards.

From: Anacron <email address hidden>
To: <email address hidden>
Subject: Anacron job 'cron.weekly' on dymaxion.cjsa2.com

/etc/cron.weekly/apt-xapian-index:
Exception ignored in: <bound method ServerProgress.__del__ of
<axi.indexer.ServerProgress object at 0x7fc8c3e631d0>>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/axi/indexer.py", line 306, in __del__
TypeError: 'NoneType' object is not callable

Revision history for this message
kolAflash (colaflash) wrote :
Revision history for this message
Ariel Faigon (ariel.faigon) wrote :

Also started seeing this on vanilla 16.04.2 (don't recall seeing it earlier):

Output from Anacron job 'cron.weekly' (running as root):

/etc/cron.weekly/apt-xapian-index:
Exception ignored in: <bound method ServerProgress.__del__ of
<axi.indexer.ServerProgress object at 0x7fdff775e6d8>>
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'

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.