Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 159518 - cache.sqlite.database database is locked InitializationError
Summary: cache.sqlite.database database is locked InitializationError
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Portage team
Keywords: InVCS
Depends on:
Blocks: 147007
  Show dependency tree
Reported: 2006-12-30 16:05 UTC by Jakub Moc (RETIRED)
Modified: 2006-12-31 09:07 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Moc (RETIRED) gentoo-dev 2006-12-30 16:05:33 UTC
$ emerge --info
Traceback (most recent call last):
  File "/usr/bin/emerge", line 5254, in ?
    retval = emerge_main()
  File "/usr/bin/emerge", line 4944, in emerge_main
    portdb = trees[settings["ROOT"]]["porttree"].dbapi
  File "/usr/lib/portage/pym/", line 882, in __getitem__
    return value_callable(*pargs, **kwargs)
  File "/usr/lib/portage/pym/", line 866, in __call__
    self._value = self._callable(*self._pargs, **self._kwargs)
  File "/usr/lib/portage/pym/", line 4457, in __init__
    self.dbapi = portdbapi(
  File "/usr/lib/portage/pym/", line 5469, in __init__
    self.auxdb[x] = self.auxdbmodule(
  File "/usr/lib/portage/pym/cache/", line 41, in __init__
  File "/usr/lib/portage/pym/cache/", line 62, in _db_init_connection
    raise cache_errors.InitializationError(self.__class__, e)
cache.cache_errors.InitializationError: Creation of instance <class 'cache.sqlite.database'> failed due to database is locked

Would be nice to handle this a bit more gracefully (IIRC this doesn't happen with default metadata cache).
Comment 1 Zac Medico gentoo-dev 2006-12-30 18:09:47 UTC
As per our discussion on irc, after removing /var/cache/edb/dep/usr/portage.sqlite and running emerge --metadata, we are unable to reproduce this error (with sqlite-3.3.6 and pysqlite-2.3.1 on x86).  I'm not sure what might have triggered that.  According to the sqlite docs at, "In order to maximize concurrency, SQLite works to minimize the amount of time that EXCLUSIVE locks are held".  For reference, portage's sqlite cache module uses sqlite3's default "autocommit" mode.
Comment 2 Zac Medico gentoo-dev 2006-12-30 19:35:27 UTC
After looking at some pysqlite bug reports, I've decided to increase the timeout for 'database is locked' errors from 5 seconds to 15 seconds (in svn r5434).  For reference, these are the bugs:
Comment 3 Zac Medico gentoo-dev 2006-12-31 09:07:44 UTC
This has been released in 2.1.2_rc4-r4.