Portato - A Portage GUI

Make all portage access from one thread/process

Reported by René 'Necoro' Neumann on 2010-04-15
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Portato
Low
Unassigned

Bug Description

Currently portato uses several threads to access portage. This won't work with its sqlite cache backend ... and isn't supported either.

<zmedico> Necoro: hmm, I guess you need to do all your portage api access in a single thread. it's never been thread safe.

Here is an sql exception:

Exception in thread "Show Updates Thread":
Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/portato/gui/utils.py", line 40, in run
    Thread.run(self)
  File "/usr/lib64/python2.6/threading.py", line 477, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib64/python2.6/site-packages/portato/gui/windows/main.py", line 1685, in __update
    packages.extend(pkg_generator())
  File "/usr/lib64/python2.6/site-packages/portato/gui/windows/main.py", line 1700, in <lambda>
    lambda: (x.get_cpv() for x in system.get_updated_packages()),
  File "/usr/lib64/python2.6/site-packages/portato/backend/portage/system.py", line 301, in get_updated_packages
    packages = self.get_new_packages(self.find_packages(pkgSet = self.SET_INSTALLED, with_version = False))
  File "/usr/lib64/python2.6/site-packages/portato/backend/portage/system.py", line 275, in get_new_packages
    inst = self.find_packages(p, self.SET_INSTALLED)
  File "/usr/lib64/python2.6/site-packages/portato/backend/portage/system.py", line 231, in find_packages
    return self.geneticize_list(self._get_set(pkgSet).find(key, masked, with_version, only_cpv), only_cpv or not with_version)
  File "/usr/lib64/python2.6/site-packages/portato/backend/portage/system.py", line 187, in geneticize_list
    return [self.new_package(x) for x in list_of_packages]
  File "/usr/lib64/python2.6/site-packages/portato/backend/portage/system.py", line 68, in new_package
    return PortagePackage(cpv)
  File "/usr/lib64/python2.6/site-packages/portato/backend/portage/package.py", line 54, in __init__
    self._status = portage.getmaskingstatus(self.get_cpv(), settings = self._settings.settings)
  File "/usr/lib64/portage/pym/portage/package/ebuild/getmaskingstatus.py", line 40, in getmaskingstatus
    metadata = dict(zip(db_keys, portdb.aux_get(mycpv, db_keys)))
  File "/usr/lib64/portage/pym/portage/dbapi/porttree.py", line 663, in aux_get
    mydata, st, emtime = self._pull_valid_cache(mycpv, myebuild, mylocation)
  File "/usr/lib64/portage/pym/portage/dbapi/porttree.py", line 608, in _pull_valid_cache
    metadata = auxdb[cpv]
  File "/usr/lib64/portage/pym/portage/cache/template.py", line 42, in __getitem__
    d=self._getitem(cpv)
  File "/usr/lib64/portage/pym/portage/cache/sqlite.py", line 162, in _getitem
    self._db_escape_string(cpv)))
ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id 139805472351984 and this is thread id 139805080684816

Portato version: 0.14_alpha (git: 9f720636bbe5db2e0d21fe580357b92e65d7f269)
System: Gentoo
Python version: 2.6.4 (r264:75706, Mar 10 2010, 03:10:05)
[GCC 4.3.4]
Used backend: Portage 2.1.8.3
Used database type: sql
pygtk: 2.16.0 (using GTK+: 2.18.7)
pygobject: 2.18.0 (using GLib: 2.22.4)

Changed in portato:
importance: Undecided → Low
status: New → Confirmed
René 'Necoro' Neumann (necoro) wrote :

For the moment, sqlite backend of portage will make portato bail out in master and 0.14

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers